Last post Jun 22, 2007 04:32 AM by vijaypvb
Mar 27, 2007 05:50 PM|vijaypvb|LINK
I am using Enterprise Library 2006 - Data Access Application block for console application. I have around 10 console applications created. I am not using App.config file for those console applications created. Also I am forced to build the connection string
dynamically. Hence I didnt specify anything in the app.config file. I am using sqldatabase class for establishing the connection using the dynamically generated connection string as shown below:
dim db as new sqldatabase("server=something;UID=usrxyz;pwd=;database=something;")
Then I will be executing the sql statement by assigning it to the command object(dbCommand) as shown below:
Dim dtOutput as dataset = db.Executedataset(dbCommand)
In this way, I have achieved the following:
(a) eliminated app.config files for 10 console applications
(b) would be able to create the connection string dynamically and pass it to the sqldatabase class
Here is the question comes
What should I do if I have to establish the connection through system DSN? I am unable to establish the DSN connection "DSN=systemdsn;Uid=usrxyz;pwd=pwdxyz;" using the sqldatabase class. I believe the sqldatabase class is meant only for the sqlclient provider.
Do you guys have any other suggestions??
Please note that I have not modified anything in Data Access component.
Jun 22, 2007 04:32 AM|vijaypvb|LINK
DSN connection can be achieved only through odbc provider.