Syntax for connecting to MS Sql DSN

Results 1 to 2 of 2

Thread: Syntax for connecting to MS Sql DSN

  1. #1
    LizJ Guest

    Default Syntax for connecting to MS Sql DSN

    Can someone please tell me the syntax for connecting to MS SQL server using ASP<BR><BR>Thanks

  2. #2
    Scott S Guest

    Default RE: Syntax for connecting to MS Sql DSN

    Sure thing, here goes...<BR><BR>dim CONN, ORS, SQLSTMNT &#039Declare variables for Connection & Recordset & SQL Statment<BR>Set CONN = Server.CreateObject("ADODB.CONNECTION")<BR>CONN.Op en "DSN=YourDSNHERE;UID=YouUsernameHere;PWD=YourPASSW ORDHERE"<BR>&#039From here you can do all sorts of things, the simplest of which<BR><BR>&#039build your sql statement<BR>SQLSTMNT = "SELECT * FROM SOMETABLE WHERE SOMEFIELD = &#039" & username & "&#039;"<BR><BR>Set ORS = CONN.Execute(SQLSTMNT)<BR><BR>there are a million variations to this, if you need to do a stored procedure & get back its return values, then you will need ADODB.COMMAND if you need to do soem complex recordset stuff you will need ADODB.RECORDSET. but if you just want to display a table or query this will work fine. <BR><BR>hope that helps<BR>Scott S<BR><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