dll connect to SQL

Results 1 to 3 of 3

Thread: dll connect to SQL

  1. #1
    Davis Guest

    Default dll connect to SQL

    I am using a VB dll in my ASP to connect to a SQL database and I get the error: The connection cannot be used to perform this operation. It is either closed or invalid in this context.<BR><BR>I don&#039t get it, because I tried using the code to connect to the database straight in the ASP page and that works fine. But when I put it in a DLL and then it errors. I have other code in the DLL that is working fine, and I am able to connect to an ACCESS database through the DLL just fine.<BR>One thing is that I am using ADO. However I use ADO for the ACCESS database connection and that works fine. I close the connection then try the same for the SQL connection and I get the error.<BR>The code in the DLL to connect is:<BR>conDSN.Provider="MSDASQL"<BR>conDSN.Connect ionString="DSN=" & strDSN & ";UID=sa;"<BR>conDSN.open<BR>Any ideas would be very much appreciated.

  2. #2
    Join Date
    Dec 1969

    Default RE: dll connect to SQL

    first of all, don&#039t specify a provider AND use a DSN. better still, don&#039t use a DSN at all. use a DSN-less string, preferable through SQLOLEDB<BR><BR>j

  3. #3
    Aditee Gupte Guest

    Default RE: dll connect to SQL

    if you are specifying the DSN then you dont need to specify the provider. Besides the provider for SQL server is<BR>conn.Provider = "SQLOLEDB"<BR>Then you also need to specify the foll.<BR>conn.ConnectionString = "User ID=urUID;Password=urPWD;" & _<BR> "Data Source=your SQL SERVER NAME;" &_<BR> "Initial Catalog=Your data base name"<BR><BR>Or else you just specify the DSN as follows (w/0 the provider)<BR>conn.ConnectionString = "Data Source=DSNNAME"<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts