problem in connection string in vb.net1.1
-
Sir, I am using connection string in the following format
Dim cnstr As String = "Provider=Microsoft.Jet.Oledb.4.0;data source=C:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\WindowsApplication1\db1.mdb"
But when I use connection string in the following format it shows error and connection does not get establishment.Dim cnstr As String = "Provider=Microsoft.Jet.Oledb.4.0;data source=WindowsApplication1\db1.mdb"
I don't want to declare the full path. Please help me Thanks and Regards amaneet Brar -
Sir, I am using connection string in the following format
Dim cnstr As String = "Provider=Microsoft.Jet.Oledb.4.0;data source=C:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\WindowsApplication1\db1.mdb"
But when I use connection string in the following format it shows error and connection does not get establishment.Dim cnstr As String = "Provider=Microsoft.Jet.Oledb.4.0;data source=WindowsApplication1\db1.mdb"
I don't want to declare the full path. Please help me Thanks and Regards amaneet Braramaneet wrote:
I don't want to declare the full path.
Then try this (assuming that the MDB is in the application path):
Dim cnstr As String = "Provider=Microsoft.Jet.Oledb.4.0;data source=" & Application.StartupPath & "db1.mdb"
...Steve
1. quod erat demonstrandum 2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once :-) -
amaneet wrote:
I don't want to declare the full path.
Then try this (assuming that the MDB is in the application path):
Dim cnstr As String = "Provider=Microsoft.Jet.Oledb.4.0;data source=" & Application.StartupPath & "db1.mdb"
...Steve
1. quod erat demonstrandum 2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once :-)