K
Kong
hi,
Currently, i am doing an asset management with asp and the microsoft
access database. the operating system environment is windows XP
professional edition, service pack 2.
However, after i finish the database design part and testing it, (at my
company's computer), it only can retrieve the data that i key-in
manually into the database and appear on the screen via the system.
However, i can't modify, delete and add new record into the access
database via the designed system. But, when i run the same system at
the personal computer at my home, in same operating system environment,
it runs normally.
--------------------------------------------------------------------------------------------
The eror message that i can view via the browser are as followings:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14) [Microsoft]
[ODBC Microsoft Access Driver] Number of query values and definition
fields are not the same.
/j03/asset.asp, line 301
------------------------------------------------------------------------------------
The line that has problem as mentioned in the error type is as
followings:
con.Execute sql, Recordsaffected
---------------------------------------------------------------------------------------
I try to modify the codes in other way round, it still bring the same
error message. Hope to gain the solution on this poblems here.
-----------------------------------------------------------------------
Codes are as followings:
<% if Request("submit.x") <> "" then
openAddress con
SQL = "Select * from assetdetails where asset_id = '" &
request("asset_id") & "'"
set rs=con.Execute(SQL)
if Not rs.EOF then
response.write("<script>alert('Asset ID does exist');</script>")
else
SQL = "Insert into assetdetails (asset_id,asset_name,staff_id," & _
"staff_name,asset_type,location," & _
"department,dateupdate,updateby) " & _
"values ('" & Request("asset_id") & "','" & _
ucase(Request("asset_name")) & "','" & Request("staff_id") & _
"','" & ucase(Request("asset_type")) & "','" & Request("staff_name")
& _
"','" & Request("location") & "','" & Request("department") & _
"','" & Request("ser_num") & "','" & Request("manufacturer") & _
"','" & Request("staff_tel") & "','" & Request("remark") & _
"','" & date & "','" & session("session_id") & "')"
con.Execute sql, Recordsaffected
con.close
Response.Write("Record was add successful")
end if
elseif Request("update.x") <> "" then
openAddress con
SQL = "Update assetdetails set asset_name='" &
ucase(Request("asset_name")) & _
"',staff_id='" & Request("staff_id") &"',asset_typeo='" &
Request("asset_type") & _
"',staff_name='" & Request("staff_name") & "',location='" &
Request("location") & _
"','" & Request("staff_tel") & "','" & Request("remark") & _
"','" & Request("ser_num") & "','" & Request("manufacturer") & _
"',updateby='" & session("session_id") & "',dateupdate='" & date & _
"',department='" & ucase(Request("department")) & "' where
asset_id='" & Request("asset_id") & "'"
con.Execute sql, Recordsaffected
con.close
Response.Write("Record was update successful")
elseif Request("delete.x") <> "" then
openAddress con
SQL = "Delete from assetdetails where asset_id='" &
Request("asset_id") & "'"
con.Execute sql, Recordsaffected
errMess = "False"
con.close
if errMess = "True" then
Response.Write("You dont have permission to delete this data.")
else
Response.Write("Record was delete successful.")
end if
end if
%>
Currently, i am doing an asset management with asp and the microsoft
access database. the operating system environment is windows XP
professional edition, service pack 2.
However, after i finish the database design part and testing it, (at my
company's computer), it only can retrieve the data that i key-in
manually into the database and appear on the screen via the system.
However, i can't modify, delete and add new record into the access
database via the designed system. But, when i run the same system at
the personal computer at my home, in same operating system environment,
it runs normally.
--------------------------------------------------------------------------------------------
The eror message that i can view via the browser are as followings:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14) [Microsoft]
[ODBC Microsoft Access Driver] Number of query values and definition
fields are not the same.
/j03/asset.asp, line 301
------------------------------------------------------------------------------------
The line that has problem as mentioned in the error type is as
followings:
con.Execute sql, Recordsaffected
---------------------------------------------------------------------------------------
I try to modify the codes in other way round, it still bring the same
error message. Hope to gain the solution on this poblems here.
-----------------------------------------------------------------------
Codes are as followings:
<% if Request("submit.x") <> "" then
openAddress con
SQL = "Select * from assetdetails where asset_id = '" &
request("asset_id") & "'"
set rs=con.Execute(SQL)
if Not rs.EOF then
response.write("<script>alert('Asset ID does exist');</script>")
else
SQL = "Insert into assetdetails (asset_id,asset_name,staff_id," & _
"staff_name,asset_type,location," & _
"department,dateupdate,updateby) " & _
"values ('" & Request("asset_id") & "','" & _
ucase(Request("asset_name")) & "','" & Request("staff_id") & _
"','" & ucase(Request("asset_type")) & "','" & Request("staff_name")
& _
"','" & Request("location") & "','" & Request("department") & _
"','" & Request("ser_num") & "','" & Request("manufacturer") & _
"','" & Request("staff_tel") & "','" & Request("remark") & _
"','" & date & "','" & session("session_id") & "')"
con.Execute sql, Recordsaffected
con.close
Response.Write("Record was add successful")
end if
elseif Request("update.x") <> "" then
openAddress con
SQL = "Update assetdetails set asset_name='" &
ucase(Request("asset_name")) & _
"',staff_id='" & Request("staff_id") &"',asset_typeo='" &
Request("asset_type") & _
"',staff_name='" & Request("staff_name") & "',location='" &
Request("location") & _
"','" & Request("staff_tel") & "','" & Request("remark") & _
"','" & Request("ser_num") & "','" & Request("manufacturer") & _
"',updateby='" & session("session_id") & "',dateupdate='" & date & _
"',department='" & ucase(Request("department")) & "' where
asset_id='" & Request("asset_id") & "'"
con.Execute sql, Recordsaffected
con.close
Response.Write("Record was update successful")
elseif Request("delete.x") <> "" then
openAddress con
SQL = "Delete from assetdetails where asset_id='" &
Request("asset_id") & "'"
con.Execute sql, Recordsaffected
errMess = "False"
con.close
if errMess = "True" then
Response.Write("You dont have permission to delete this data.")
else
Response.Write("Record was delete successful.")
end if
end if
%>