|
-
Mar 26th, 2017, 08:02 AM
#1
Thread Starter
Junior Member
visual basic 6, ms access, adodc
where to store image filename path via visual basic 6 in a DB table? so that when i click update command on a form, students datails and picture filename along with extension will gets store in a access database and display record that i've entered
-
Mar 26th, 2017, 09:29 AM
#2
Re: visual basic 6, ms access, adodc
If you store the file's path/filename, it doesn't matter what table/field you use because you are only storing a string. However, 2 potential problems.
1. If the VB app is ever moved to a different computer or the picture's path/filename changes, or the picture is deleted from the disk, then you have no picture any longer
2. If the table's field length is 255, that may not be large enough to hold the complete file/path name
A better solution may be to store the picture itself in the database instead of the path/filename. In the Datbase section of the forum, open the FAQ page and search for these key words: pictures Access. There are examples there.
-
Mar 26th, 2017, 12:48 PM
#3
Re: visual basic 6, ms access, adodc
If the pictures are stored outside of the database in some folder than you probably don't need that folder path recorded for each one. In that case a TEXT(255) field should be plenty unless you are capturing pictures and storing them as "Unicode" file names, usually fruitlessly wasteful anyway.
Lots of agony over Unicode can be avoided simply by sticking to the 7-bit ASCII character subset for things like this. Such file names ought to be internal anyway, your program has to generate them or at least ensure they are unique, so you have full control. No need for funky accented Roman letters or non-Roman alphabets. Your database should have the person's name (which might not even be unique) with a mapping to a unique image file name which could be a number or a hash of the name and a timestamp of the creation time or something.
-
Mar 28th, 2017, 06:30 AM
#4
Thread Starter
Junior Member
Re: visual basic 6, ms access, adodc
thank very much for your reply
BUT can you help me a bit with coding, because i have heard that we can link the pictures from picturebox to maccess
-
Mar 28th, 2017, 02:56 PM
#5
Re: visual basic 6, ms access, adodc
"Linking" only in a very casual sense.
You store a file name as a String value. Your program has to do any "linking" since the database only knows about the String values. You have to store the files and retrieve the files as pictures.
No clue where MSAccess comes in. Are you using VB6 or Access?
Don't confuse yourself by talking about "Access databses." These are Jet databases, though if MS Access touches them it dumps a ton of private structures into them since it uses them to hold cruft such as its forms and macro code.
-
Mar 28th, 2017, 08:19 PM
#6
Re: visual basic 6, ms access, adodc
Back in the day when I was first learning to use Access as a backend I created a little app that used pictures which would be stored in an Access 97 database.
All I had to do was bind the db field to a picture box on the form. This was in VB5 using the DAO data control
I have no idea if that is still supported with ADO and/or new versions of MSAccess or not but it was very simple back when I gave it a try.
The picture box auto loaded the images as the record pointer changed and if memory serves you could use load picture to add a picture to the picture box then when updating the record that picture would be saved to the db.
It has been a long time but I am pretty sure that is all there was to it. I know I only spent about 10 minutes on it
-
Mar 29th, 2017, 01:37 AM
#7
Re: visual basic 6, ms access, adodc
That still works and you can do without data binding too.
It often isn't the first choice except for databases that will never get large. Images take a lot of space and you can run into the limits of .MDB and even .ACCDB files fairly fast. It doesn't help that a lot of people end up storing bulky BMP images instead of compressing to GIF or JPEG (or even PNG with a little care though that is usually off the table for bound controls).
-
Mar 29th, 2017, 10:30 PM
#8
Thread Starter
Junior Member
Re: visual basic 6, ms access, adodc
Means after updating on a form
When I'll open msaccess, then database that I've created from Add in using Vb6, then straight after that I'll double click and open the table , so i wanna see all those information that I've stored in the database using form.
Though I can already see some of the details , but couldn't find picture name like logo.jpg I want it see picture name with extension there too, followed by name, address and so on.
-
Apr 9th, 2017, 04:03 PM
#9
Thread Starter
Junior Member
Save/load images in a Picturebox using standard code
can anyone help me how to display picture name with extension in a access database table
eg logo.jpg (link to a image that locate on folder ) from picture box or from a database table
-
Apr 9th, 2017, 04:25 PM
#10
Re: Save/load images in a Picturebox using standard code
1. Do you know the full path of the picture file?
2. Do you know how to insert data into a table?
There are others ways of doing this as well, but it is pretty simple. If you answered yes to #'s 1 and 2, you can simply insert the full path name (along with the file name) into a table. If all pictures are located in the same folder, you don't need to do that, just append the path to the filename when you retrieve it from the db.
-
Apr 9th, 2017, 04:26 PM
#11
Re: Save/load images in a Picturebox using standard code
oops! I just noticed you posted the same question earlier...don't start a new thread...just get your question answered on the other one....
-
Apr 9th, 2017, 04:47 PM
#12
Thread Starter
Junior Member
Re: Save/load images in a Picturebox using standard code
how to append the path to file name
-
Apr 9th, 2017, 04:57 PM
#13
Thread Starter
Junior Member
Re: Save/load images in a Picturebox using standard code
sorry if am troubling you but somehow i am trying to understand it in a simple way. Since i am a new in vb6 i dont have much idea about this topic
-
Apr 9th, 2017, 04:59 PM
#14
Re: Save/load images in a Picturebox using standard code
string concatenation
let's say the folder is located in "C:\Users\siddhanth\AppData\pictures"
You may want to put that in a variable, like "myAppPathForPictures"
ex: Dim myAppPathForPictures as string
myAppPathForPictures = "C:\Users\siddhanth\AppData\pictures\"
and your picture filename is logo.jpg
Then for the full path, could be: myAppPathForPictures & "logo.jpg"
Last edited by SamOscarBrown; Apr 10th, 2017 at 09:41 AM.
Reason: forgot quotes around logo.jpg
-
Apr 10th, 2017, 08:56 AM
#15
Re: visual basic 6, ms access, adodc
Merged the two threads together. The OP didn't really start this second thread, it was attached to a different thread and I split it out into a new thread without realizing that it really belonged to this thread.
My usual boring signature: Nothing
 
-
Apr 10th, 2017, 01:46 PM
#16
Thread Starter
Junior Member
Re: Save/load images in a Picturebox using standard code
thanks SamOscarBrown for help i've tried your example just now, but still nt getting the desire result
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|