Question Connecting to database

brandonyoung

Member
Joined
Apr 26, 2011
Messages
12
Programming Experience
3-5
I am needing some help writing to a database.

I have written a relatively large application for a nursery school using text files as my source of permanent storage. I have decided that it would be more productive and safer if I could use a database instead. I have also chosen to rewrite the program as I initially wrote the program during early stages of my degree, so the structure and implementation is not very good.

I have created a little application to connect to a MS access db. I'm able to do everything I need to do, except when I publish the project and actually install the program it gives me error messages when ever I try connect to the database, or do anything to it for that matter.

If anyone knows the answer to my problem, or a better way to deal with the permanent storage could you please let me know.

Thanks in advance.......

Here is a brief example of my code to create the database

Dim databaseName As String = "The Ascot Day Nursery.mdb"


'Creating an Access Database file using ADOX
Dim cat As ADOX.Catalog = New ADOX.Catalog()
cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & databaseName & ";Jet OLEDB:Engine Type=5")
MessageBox.Show("Database Created Successfully")
cat = Nothing
con.Close()
 

jacky.goy

Active member
Joined
Sep 19, 2006
Messages
38
Programming Experience
1-3
missing the path for database.

example :
Dim databaseName As String = "C:\dbfolder\database.mdb"
 

brandonyoung

Member
Joined
Apr 26, 2011
Messages
12
Programming Experience
3-5
So stupid.... Thankyou for the advice.

I have another question, does this mean that I could only run this aplication on a computer with MS access installed?

Thanks again,
Brandon
 

jacky.goy

Active member
Joined
Sep 19, 2006
Messages
38
Programming Experience
1-3
Nope... you can run the application on any computer without MS Access installed just when you install your app to the computer, make sure you have install all required components.
 

brandonyoung

Member
Joined
Apr 26, 2011
Messages
12
Programming Experience
3-5
Thank you again,

What exactly do you mean by that? How do I ensure to install all the components. I'm new to this whole database thing.

Thanks for your patience
 

jacky.goy

Active member
Joined
Sep 19, 2006
Messages
38
Programming Experience
1-3
when you compiling your app using the setup creator then you will be ask to include the component into it.
 
Top Bottom