The example shows how to input data from a html page, write the records to a sql server database. After the record is written all the data is passed back to the asp page and written out
Have an input form Example below show's some sample data being inputted.
Here is the results that are written out.
Code for Asp Page
'Declares all local variables dim conn dim rs dim strsql dim strsql2 dim strsql3
'First part of formatted string strsql = "DECLARE " & CHR(10) & "@Id_Req " & "INT" & CHR(10) 'Second part of Formatted string-all values from form strsql2 ="exec " & "sp_EmpInfo" & " '" & request("txtFirstName") & "'," & "'" & request("txtLastName") & "', " & "'" & request("txtaddress") & "', " & "'" & request("txtcity") & "', "& "@Id_Req " & "OUTPUT" & chr(10) Third part of formatted string strsql3 ="SELECT * FROM AllData WHERE RecordId = @Id_Req" & Chr(10) 'Putting all the values together strsql = strsql & strsql2 & strsql3 response.write "<b>" & "Sql Statement that is passed to the database" & "</b>" & "<br>" & "<br>" response.write strsql
'Create connection object & open it set conn = server.createobject("adodb.connection") conn.open "example" 'Create recordset object & place string that is executed 'so values can be stored and written out set rs = server.createobject("adodb.recordset") rs = conn.execute(strsql) %> <html> <head> <title>Results Page</title> <meta name="GENERATOR" content="Microsoft FrontPage 3.0"> </head> <body>
<p><strong>Record Id # and all information entered on <br> previous page.</strong></p>