Hi there
I have a little problem with my database connection. Im connecting to an access database using OleDbConnection. Its working perfectly on my pc. but once i install it on another, it crashes. I think it has to do with the data source or something. I've also tried creating a datalink but i get the same problem. I know this can be fixed i just cant see what im not doing right. Im using C#.net and VS2003 btw
Any ideas? thanks
Felipe MarksPosted Nov 20, 2007, 2:44 AM
Hi there
Thanks alot it's working fine now. I've changed the DataSource to the database name. I've tried it before but didnt put the database in the debug folder.
Thanks
Jan MontanoPosted Nov 19, 2007, 11:01 PM
Does each PC has it's own VotersRoll.mdb? or do you intend to only have one VotersRoll.mdb and have other machines connect to it?
If you intend to have only one mdb in your network, you should replace the DataSource value with a UNC instead.
For the UNC path, you must first share the mdb file in your machine and access it like this way from another machine: \\MarkPC\Database\VotersRoll.mdb where MarkPC is the computer name. So it will be DataSource="\\MarkPC\Database\VotersRoll.mdb"
On the other hand, if you intend to have a database file in each and every machine, you could have a definite data source path (e.g. C:\Program Files\MyApp\VotersRoll.mdb). Just make sure that the folders and the mdb exist on the machine. If I'm not mistaken, if your mdb file resides in the same path of your application, you could just specify DataSource="VotersRoll.mdb".
Felipe MarksPosted Nov 19, 2007, 9:16 AM
The path isnt, I dont know how to do that.
The database is located in the debug folder its an access file.
Here's the connection string :
Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Data Source="C:\Documents and Settings\E Marks\Desktop\VotersRoll\bin\Debug\DataBase\VotersRoll.mdb";Mode=Share Deny None;Jet OLEDB:Engine Type=5;Provider="Microsoft.Jet.OLEDB.4.0";Jet OLEDB:System database=;Jet OLEDB:SFP=False;persist security info=False;Extended Properties=;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;User ID=Admin;Jet OLEDB:Global Bulk Transactions=1
thanks
Scott LyslePosted Nov 19, 2007, 3:55 AM