Connecting syntax for SQL Server

Results 1 to 3 of 3

Thread: Connecting syntax for SQL Server

  1. #1
    Join Date
    Dec 1969

    Default Connecting syntax for SQL Server

    Could you folks give me an example of how to<BR>create the connection object and opening it<BR>using a SQL Server?<BR><BR>Thanks.

  2. #2
    Curtis Guest

    Default System DSN

    dim oConn, oRs<BR>Set oConn = Server.CreateObject("ADODB.Connection")<BR>oConn.O pen "DSN=DSI;"<BR><BR>sSQL = &#060;sql statement here&#062;<BR>oRs.Open sSQL, oConn<BR>&#039oRs now contains records relative to the return of the sSQL statement<BR>--code here--<BR><BR>&#039close recordset and connection<BR>oRs.Close<BR>oConn.Close<BR><BR>&#03 9clean up objects<BR>Set oRs = nothing<BR>Set oConn = nothing<BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default RE: Connecting syntax for SQL Server

    *<BR>OLE-DB Conntion to SQL Server...<BR>&#060;%<BR>Dim sConnect, MyConn<BR>Set MyConn = Server.CreateObject("ADODB.Connection")<BR>sConnec t = "Data Provider=SQLOLEDB; "<BR>sConnect = sConnect & "Data Source=ServerName; "<BR>sConnect = sConnect & "Initial Catalog=DBName; "<BR>sConnect = sConnect & "User ID=UserName; "<BR>sConnect = sConnect & "Password=Password " <BR>MyConn.Open sConnect<BR>%&#062;<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