<% On error Resume Next Dim connectionstring1, connectionstring2 Dim cn,cmd, rs connectionstring1 = "Provider=sqloledb;Data Source=KALPESH;Integrated Security=SSPI;Initial Catalog=Practice" connectionstring2 = "Provider=SQLNCLI11;Data Source=KALPESH;Integrated Security=SSPI;Initial Catalog=Practice" Set cn = Server.CreateObject("ADODB.Connection") Set cmd = Server.CreateObject("ADODB.Command") Set rs = Server.CreateObject("ADODB.Recordset") cn.ConnectionTimeout = 90 cmd.CommandTimeout = 180 query = "Select * from Users" cn.ConnectionString = connectinstring1 response.write "<br>OLEDB connection : " & cn.ConnectionString cn.Open cmd.ActiveConnection = cn cmd.CommandText = query Set rs = cmd.Execute If Err.number > 0 Then Response.Write("<br>" & Err.Number & " - " & Err.Description) cn.close End If cn.ConnectionString = connectinstring2 cn.Open cmd.ActiveConnection = cn cmd.CommandText = query Set rs = cmd.Execute If Err.number > 0 Then Response.Write("<br>" & Err.Number & " - " & Err.Description) cn.close End If %>
3709 - The connection cannot be used to perform this operation. It is either closed or invalid in this context. 3709 - The connection cannot be used to perform this operation. It is either closed or invalid in this context.
objMyConn.ConnectionString = "Provider=sqloledb;Data Source=KALPESH;Integrated Security=SSPI;Initial Catalog=Practice"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)