...

View Full Version : adding & saving



reian
01-17-2008, 02:25 PM
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..:(

Spudhead
01-17-2008, 05:07 PM
What do you mean, "it doesn't work"?

reian
01-19-2008, 10:07 AM
it doesnt work??
i mean the program didnt run...
i hope u can help me???



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum