Results 1 to 3 of 3

Thread: asp and sql

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 1999
    Location
    tehran,iran
    Posts
    53
    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

  2. #2
    Addicted Member Skeen's Avatar
    Join Date
    Jul 2000
    Location
    Abingdon, Oxon
    Posts
    138

    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!"

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 1999
    Location
    tehran,iran
    Posts
    53

    Wink

    thank you very much

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width