Containing object within VB.NET

shmick

Member
Joined
Jul 29, 2005
Messages
6
Programming Experience
3-5
Containing object within VB.NET EXE

Just curious if anyone knows how to add, in design or runtime, say... a .mdb file like an access database, into your executable for when it compiles.

So what I want it to do is... give someone only 1 of my executables, but when open, have a loading sequence, during this brief period, have it extract the .mdb file to a temp location, access data from it, and then delete it.

I dont need to know how to do any of the ADO.NET stuff, or anything but the actual compiling of the .mdb file within my .exe, and then extracting it. please help!
 
I assumed that you thought about setup project and that you want to include an Access DB within. Well, that's an easy task. Just start a new setup project and include the intended file/s and that's it ... after your client install on target machine .mdb file will appear on its place ... Cheers ;)
 
There are certain things, like images, that you can store as resources and save to files at runtime. If you want to use an Access database that doesn't exist until you create it, then delete it again when you're done, you would need to use ADOX to create the Access file on the fly. Ask me not how for I know not, but do an MSDN search.
 
i used ADOX a couple of times, the downside to using ADOX is that yes it does create the ms Access database's but every field made with it is tagged as required so the user (or the programmer) has to make sure that something is in everyfield or you get an update error from the DB

i played with ADOX for 4 months before i gave up on it, so if someone knows how to use it and have the fields not marked as required that'd be great

i can provide an example on how to use ADOX if anyone would like
 
i had forgotten about that

i remember playing with that demo some back when you posted it too

i never did get that darned required feild resolved either :(
 
hey guys,

well, a setup proj would be a good idea... can't believe i didnt way that option. However, I do want to be able to just have them double click my executable, and have my prog. open, and do this stuff in the back ground...

On the same note. Say it wasnt an acces db. Say I used ADOX, how about resourcing or masking a .dll inside my exe, so that it would just extract itself to the system32 dir or right along side of my exe.... any ideas?

-Mike
 
To resolve the required field problem with Adox tables, include the following statement AFTER you've done the Column Append statement:

objTable.Columns(strColumnName).Properties("Jet OLEDB:Allow Zero Length") = True


where objTable is previously declared new Adox table.

Don Seydel
 
Well, if you are going to use ADOX (warning COM object in use!) anyways, you'll need an install/setup to install the proper support dlls anyways..... soo.... why not just include the access file in the first place?

Something I was wondering that no one seemed to ask was if you want this DB to stick around? In other words, if the user enters data that you then save to the database, what happens to it the next time they open the app? Another thing to keep in mind is that if you do use ADOX, then any base data that needs to be in the database will need to be populated by code.... just something to think about.

Tg
 
The post was responding to JuggaloBrotha's comment in #4 above.

Unhappily Adox won't seem to go away: there are two circumstances where Adox seems to be the only solution to managing Access databases under .Net and ADO. Namely (a) creating a new database and (b) applying an index to a column in newly created table.

As nearly as I can tell, the index problem is an Access-imposed limitation; I have not been able to find any way to do it programatically other than using Adox.
 
i'm sure there are ways to do it through code it's just that who here wants to actually do the research and stuff when adox is already here
 
Back
Top