Forums

ASP

This topic is locked

Insert Error

Posted 28 Aug 2003 20:55:39
1
has voted
28 Aug 2003 20:55:39 CK Nyak posted:
I have an insert form which does not seem to work. The problem seems to be with the database insert. This is for an access database. Every field is long integers with the exception of employee_id which is text. the code and error is listed below

------------------------------------------------------------------------------------------------------
Here is the error.

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Number of query values and destination fields are not the same.

/mynet/projects/projectpricing.asp, line 50



Can anybody tell me what the problem is?

-------------------------------------------------------------------------------------------------------

Here is the code

< %

if(Request.form("projectID" <> "" then comInsert__pid = Request.form("projectID"
if(Request.form("employees" <> "" then comInsert__eid = Request.form("employees"
if(Request.form("rate" <> "" then comInsert__rid = Request.form("rate"
if(Request.form("hours" <> "" then comInsert__hid = Request.form("hours"

% >
< %
set comInsert = Server.CreateObject("ADODB.Command"
comInsert.ActiveConnection = MM_PO_STRING

comInsert.CommandText = "INSERT INTO ProjectRate (project_id, prate, phours, employee_id) VALUES (" + Replace(comInsert__pid, "'", "''" + "," + Replace(comInsert__rid, "'", "''" + "," + Replace(comInsert__hid, "'", "''" + ",'" + Replace(comInsert__eid, "'", "''" + "') "
comInsert.CommandType = 1
comInsert.CommandTimeout = 0
comInsert.Prepared = true
comInsert.Execute()

% >

Replies

Replied 01 Sep 2003 19:59:31
01 Sep 2003 19:59:31 Rene Bandsma replied:
Well, I don't know for sure. But when you select in the database that a specific field is an number, you cannot insert a textvalue.

It is also important that you have downloaded the latest updates for SQL and/or Access (ODBC)

Reply to this topic