toraj
Nov 17th, 2000, 06:07 AM
Hi,
Any one know a resource that contain some examples
of using sql "INSERT" method in asp.
I find many sites that show insert syntax but
not in asp.
Thanx
Skeen
Nov 17th, 2000, 06:24 AM
Heres on of my own scripts. This is a hidden script in that it returns no HTML.
The page before this has input text boxes within an html form. The form points to this page and the request.form bits extract the text from the inputboxes and place them into variables. The variables are sat inside the SQL command. After this is executed response.redirect takes the user to a confirmation page - pretty much flat html for pages 1 and 3. The user will only see 2 pages.
Heres a complete page - 'somepagename.asp'
<%
Dim caSQL
Dim cnAcqAcc
Dim cmAcqAcc
Dim rsServDat
Set cnAcqAcc = CreateObject ( "ADODB.Connection" )
cnAcqAcc.ConnectionString = "Provider=MSDASQL;DSN=DatabaseName;UID=Username;PWD=Password;"
cnAcqAcc.open
Cust_ID = Request.Form("A1")
Serv_Num = Request.Form("A2")
Serv_Code = Request.Form("A3")
Serv_Outpay = Request.Form("A4")
caSQL = "Insert Into TableName(Field1, Field2, Field3, Field4) " _
& " values ('" & Cust_ID & "','" & Serv_Num & "','" & Serv_Code & "', '" & Serv_Outpay & "') "
Set rsServDat = cnAcqAcc.Execute( caSQL )
cnAcqAcc.Close
Set rsSevDat = Nothing
Response.Redirect "data_logged.html"
%>
Hope this helps
Cheers 'n' beers
Skeen