Example of ADO Connection... Please

Results 1 to 3 of 3

Thread: Example of ADO Connection... Please

  1. #1
    Persesus Guest

    Default Example of ADO Connection... Please

    Can anyone give me code on how to connect to an SQL Server, open a recordset based on an SQL and return the recordcount?

  2. #2
    BAHEK Guest

    Default RE: Example of ADO Connection... Please

    Generally here is the sintax, but I might misspelled something:<BR><BR>Dim CN,RS,sConn,sSQL<BR>Set CN = Server.CreateObject("ADODB.Connection")<BR>Set RS = Server.CreateObject("ADODB.Recordset")<BR>sConn="P rovider=MSDASQL;driver={SQL Server};server=SQLServerName;uid=UserName;pwd=Pass word;database=DatabaseName;"<BR>CN.Open sConn<BR>sSQL="Select * from Table1"<BR>RS.Open sSQL,0<BR>Response.Write ("Found " & RS.RecordCount & " records")<BR>RS.Close<BR>Set RS=Nothing<BR>CN.Close<BR>Set CN=Nothing

  3. #3
    Persesus Guest

    Default Excellent, Cheers

    Excellent, Cheers

Posting Permissions

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