|
-
Nov 17th, 2000, 07:07 AM
#1
Thread Starter
Member
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
-
Nov 17th, 2000, 07:24 AM
#2
Addicted Member
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
"It wasn't the booze that made me snooze, It was the Gin that did me in!"
-
Nov 18th, 2000, 05:56 AM
#3
Thread Starter
Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|