S
Sanju
Hai to every one,
here is my question
I have been designed a coding to accept the information from the
user
(i.e., the Name, Staffno and comments) but when click on SUMBIT button I
am getting the following error
Microsoft Jet Database Engine (0*80040E014)
Number of query values and the destination feilds are not the same
/reports/formreport.asp,Line 29
-------------------------------------------------------------------------------------------
The coding for the above design
<html>
<% @LANGUAGE="VBScript" %>
<body>
<%
' Declaring variables
Dim username, userstaffno, usercomments, data_source,
con, sql_insert
' A Function to check if some field entered by user is
empty
Function ChkString(string)
If string = "" Then string = " "
ChkString = Replace(string, "'", "''")
End Function
' Receiving values from Form
username = ChkString(Request.Form("username"))
userstaffno = ChkString(Request.Form("userstaffno"))
usercomments = ChkString(Request.Form("usercomments"))
data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=" &_
Server.MapPath("formreport.mdb")
sql_insert = "insert into formreport
(username,userstaffno,usercomments)"
sql_insert = sql_insert & " values (' "&
Request.Form("username") & " ',' " & Request.Form("userstaffno") & " ',' " &
Request.Form(" usercomments") & " ',' " & " ' )"
' Creating Connection Object and opening the database
Set con = Server.CreateObject("ADODB.Connection")
con.Open data_source
con.Execute sql_insert
' Done. Close the connection
con.Close
Set con = Nothing
Set sql_insert = Nothing
Response.Write "All records were successfully entered
into the database."
%>
</body>
</html>
Thanks in advance
here is my question
I have been designed a coding to accept the information from the
user
(i.e., the Name, Staffno and comments) but when click on SUMBIT button I
am getting the following error
Microsoft Jet Database Engine (0*80040E014)
Number of query values and the destination feilds are not the same
/reports/formreport.asp,Line 29
-------------------------------------------------------------------------------------------
The coding for the above design
<html>
<% @LANGUAGE="VBScript" %>
<body>
<%
' Declaring variables
Dim username, userstaffno, usercomments, data_source,
con, sql_insert
' A Function to check if some field entered by user is
empty
Function ChkString(string)
If string = "" Then string = " "
ChkString = Replace(string, "'", "''")
End Function
' Receiving values from Form
username = ChkString(Request.Form("username"))
userstaffno = ChkString(Request.Form("userstaffno"))
usercomments = ChkString(Request.Form("usercomments"))
data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=" &_
Server.MapPath("formreport.mdb")
sql_insert = "insert into formreport
(username,userstaffno,usercomments)"
sql_insert = sql_insert & " values (' "&
Request.Form("username") & " ',' " & Request.Form("userstaffno") & " ',' " &
Request.Form(" usercomments") & " ',' " & " ' )"
' Creating Connection Object and opening the database
Set con = Server.CreateObject("ADODB.Connection")
con.Open data_source
con.Execute sql_insert
' Done. Close the connection
con.Close
Set con = Nothing
Set sql_insert = Nothing
Response.Write "All records were successfully entered
into the database."
%>
</body>
</html>
Thanks in advance