Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: adding & saving

  1. #1
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    adding & saving

    hey guys,,hu can help me checking mg code..
    i dont know wat is the problem but still it doesnt work..
    pls. hu can help me???

    below is my code:


    this is the code of the form wen if you wanna save:
    wat do u think is the problem??



    <%@ Language = "VBScript"%>
    <%
    Option Explicit

    'Declare all local variables
    dim conn
    dim rs
    dim strconn
    dim strsql


    'on error resume next

    strsql = ""

    set conn=Server.CreateObject("ADODB.Connection")
    'set connection string to local variable-I use a DSN-less connection
    strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("login.mdb")

    conn.Open strconn

    If err.Number <> 0 Then
    %>
    <Script Language= "VBScript">
    MsgBox("Please complete the form!")
    OnClick = history.go(-1)
    </SCRIPT>
    <%
    err.Clear
    else
    'build the sql statement based on the input from the form
    strSQL = "INSERT INTO form(surname, firstname, middlename, cityadd, proadd, month, day, year, age, female, male, telno, faxno, celno, celno2, email, fatname, monname, broname, sisname, single, married, spouse, age1, compname, position, address, telno1, children, highsch, colldept1, college, colldept2, masteral, colldept3, doctoral, colldept4, company, compad, item, telnum, status, offreceipt, alumid, month1, day1, year1, month2, day2, year2) Values(" & request("surname") & ",'" & Replace(request("fname"),"'","''") & "','" & Replace(request("mname"),"'","''") & "','" & Replace(request("citname"),"'","''") & "','" & Replace(request("proadd"),"'","''") & "','" & Replace(request("month"),"'","''") & "','" & Replace(request("day"),"'","''") & "','" & Replace(request("yr"),"'","''") & "', '" & Replace(request("age"),"'","''") & "', '" & Replace(request("male"),"'","''") & "','" & Replace(request("fmale"),"'","''") & "','" & Replace(request("telno"),"'","''") & "','" & replace(request("fno"),"'","''") & "','" & Replace(request("celno"),"'","''") & "'," & request("celno1") & ", '" & Replace(request("email"),"'","''") & "','" & Replace(request("fname"),"'","''") & "','" & Replace(request("mname"),"'","''") & "','" & Replace(request("bro"),"'","''") & "','" & Replace(request("sis"),"'","''") & "','" & Replace(request("status1"),"'","''") & "','" & Replace(request("status2"),"'","''") & "','" & Replace(request("spou"),"'","''") & "','" & Replace(request("aged"),"'","''") & "','" & Replace(request("com"),"'","''") & "','" & Replace(request("pos"),"'","''") & "','" & Replace(request("add"),"'","''") & "','" & Replace(request("tel"),"'","''") & "','" & Replace(request("chil"),"'","''") & "','" & Replace(request("high"),"'","''") & "','" & Replace(request("hi"),"'","''") & "','" & Replace(request("colge"),"'","''") & "','" & Replace(request("col"),"'","''") & "','" & Replace(request("mast"),"'","''") & "','" & Replace(request("mas"),"'","''") & "','" & Replace(request("doct"),"'","''") & "',,'" & Replace(request("doc"),"'","''") & "','" & Replace(request("co"),"'","''") & "','" & Replace(request("coad"),"'","''") & "','" & Replace(request("item"),"'","''") & "','" & Replace(request("stat"),"'","''") & "','" & Replace(request("tno"),"'","''") & "','" & Replace(request("receipt"),"'","''") & "','" & Replace(request("alum"),"'","''") & "','" & Replace(request("mon"),"'","''") & "','" & Replace(request("day1"),"'","''") & "','" & Replace(request("iyr"),"'","''") & "','" & Replace(request("mont"),"'","''") & "','" & Replace(request("day2"),"'","''") & "','" & Replace(request("year1"),"'","''") & "');"
    'Set connection object
    'conn.open strSQL
    'Use the execute method of the connection object the insert the record
    conn.execute(strSQL)
    end if

    conn.close
    set conn = nothing

    Response.Redirect "addform.asp"
    %>
    <html><head>
    </head>

    <body>
    Your record has been updated
    </body>
    </html>



    tnx on someone hu can help me..
    i realy need it asap..

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    What do you mean, "it doesn't work"?

  • #3
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    adding & saving

    it doesnt work??
    i mean the program didnt run...
    i hope u can help me???


  •  

    Posting Permissions

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