Question in Data Access Component RRS feed

  • Question

  • User-872532316 posted

    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.

    Tuesday, March 27, 2007 5:50 PM


  • User-872532316 posted

    DSN connection can be achieved only through odbc provider.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 22, 2007 4:32 AM