Connection|select <%
Dim conn
Dim strconn
Dim rs
Dim strSQL
Dim strsql2
Dim strsql3
Dim strsql4
Dim strsql5
Dim strsql6
Dim Strsql7
Dim Strsql8
' strconn = Driver={sql Server};D escription=example; server=222.222.1.2; Uid=webexample; pwd=;D Atabase=webexample "
' Format Declare & EXEC Statements that'll be passed
"To the" database with the output parameters
strSQL = "DECLARE" & CHR (Ten) & "@Id_Req" & "INT" & CHR (10)
STRSQL2 = "Exec" & "Sp_empinfo" & "" & Request ("txtFirstName") & "'," & "'" & Request ("Txtlastna Me ") &", "&" "& Request (" Txtaddress ") &", "&" ' "& Request (" Txtcity ") &" "," & "@i D_req "& OUTPUT" & Chr (10)
' Formats one or more SQL statements that'll be passed to the
' Database in this examples I use six different ways.
STRSQL3 = "SELECT * from alldata WHERE RecordID = @Id_Req" & Chr (10)
STRSQL4 = "Select Alldata.fname, alldata.lname from alldata WHERE RecordID = @Id_Req" & Chr (10)
STRSQL5 = "Select Alldata.fname from alldata WHERE RecordID = @Id_Req" & Chr (10)
strsql6 = "Select Alldata.lname from alldata WHERE RecordID = @Id_Req" & Chr (10)
STRSQL7 = "Select Alldata.address from alldata WHERE RecordID = @Id_Req" & Chr (10)
Strsql8 = "Select Alldata.city from alldata WHERE RecordID = @Id_Req" & Chr (10)
' Puts together all of the local variables into one variable
' That'll be used by the Recordset object
strSQL = strSQL & strsql2 & strsql3 & Strsql4 & strsql5 & strsql6 & Strsql7 & Strsql8
' This is optional the writes out of the strSQL local variable
' That'll be passed to the database
Response.Write "<b>" & "Sql Statement" is passed to the database "&" </b> "&" <br> "
Response.Write strSQL & "<br>" & "<br>"
' Sets a connection & Recordset objects and executes the strSQL local variable
Set conn = Server.CreateObject ("Adodb.connection")
Conn.Open strconn
Set rs = Server.CreateObject ("Adodb.recordset")
Rs.Open strSQL, Conn
' Parses out the individual recordsets and places them
' into individual table rows
intcount = 1
Do Until rs are nothing
Response.Write "<table border= ' 1 ' width= ' 25% ' >"
Response.Write "<b> Contents of Recordset #" & intcount & "</b><br>"
' Parses out of the individual recordsets and places them into table rows
Do but not Rs. Eof
Response.Write "<TR>"
For each ofield in RS. Fields
Response.Write "<TH>" & Ofield.name & "</TH>"
Next
Response.Write "</TR>" & "<TR>"
For each ofield in RS. Fields
Response.Write "<td align=center>"
If IsNull (Ofield) Then
Response.Write ""
Else
Response.Write Ofield.value
End If
Response.Write "</TD>"
Next
Rs. MoveNext
Loop
' Uses the NextRecordset method
Set rs = rs. NextRecordset
intcount = intcount + 1
Response.Write "</table>"
Loop
%>