PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
ConnectionStringBuilder: Automatic quoting problem
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
ConnectionStringBuilder: Automatic quoting problem
![]() |
ConnectionStringBuilder: Automatic quoting problem |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
I've got a form that allows the user to enter the information to build a
connection string for various data connection types. I've run into a problem testing the ODBC for a dsn-less connection, using a MS Access database. I fill out the minimum required information (Driver and Datasource/Dbq), but the string would always fail to open a connection. This is the code used: csb.Add( "Driver", settings.Driver ); csb.Add( "Dbq", settings.DataSource ); This is an example of what the CSB would return: Driver="{Microsoft Access Driver (*.mdb)}";Dbq=d:\work\reporter1.mdb What I found to be the problem is the quoting around the Driver text, which is added autmomatically by the CSB. If I remove the quotes before using the string, then it works perfectly. Doing some reading, I saw a reference that indicated that this quoting is done as a security measure to prevent injection attacks. Am I using the ConnectionStringBuilder incorrectly? Michael |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Micheel
The same as to David, why using ODBC it is limited in all kind of designers. For your Jet (access) database is OleDB the best. Cor "Michael Russell" <mr_b15h0p@hotmail.com> schreef in bericht news:O4jbwvnkGHA.836@TK2MSFTNGP02.phx.gbl... > I've got a form that allows the user to enter the information to build a > connection string for various data connection types. I've run into a > problem testing the ODBC for a dsn-less connection, using a MS Access > database. > > I fill out the minimum required information (Driver and Datasource/Dbq), > but the string would always fail to open a connection. > > This is the code used: > csb.Add( "Driver", settings.Driver ); > csb.Add( "Dbq", settings.DataSource ); > > This is an example of what the CSB would return: > Driver="{Microsoft Access Driver (*.mdb)}";Dbq=d:\work\reporter1.mdb > > What I found to be the problem is the quoting around the Driver text, > which is added autmomatically by the CSB. If I remove the quotes before > using the string, then it works perfectly. > > Doing some reading, I saw a reference that indicated that this quoting is > done as a security measure to prevent injection attacks. Am I using the > ConnectionStringBuilder incorrectly? > > Michael |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

