Reply
Problem adding record to access db
Old 11-13-2006, 10:39 AM Problem adding record to access db
Junior Talker

Posts: 1
Name: Cooper
I've created an admin function to handle a "picture of the week" off our index, and im trying to update the db with the inputted data: weekStart, weekEnd, sourceFile. The name of the database is dB.mdb and is in the same folder as the file. The name of the table is pow and has the following columns: id (number, indexed with no duplicates), weekStart (text), weekEnd (text), sourceFile (text).

The code below is after the form had been submitted...i cross checked the values in the form to the variables in the function, it all matches. the getid function just querys the database, returns records, and adds one. With the code below i get the following error:

Microsoft JET Database Engineerror '80040e10'
No value given for one or more required parameters.
/pow/pow.asp, line 18


view code:

if request.querystring("action") = "process" then

w_start = request.form("month") & "/" & request.form("day") & "/" & request.form("year")
w_end = request.form("month2") & "/" & request.form("day2") & "/" & request.form("year2")

id = getid()

SQL="insert into pow (id,weekStart,weekEnd,sourceFile) VALUES (" & id & "," & w_start & "," & w_end & "," & request.form("source") & ")"

sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & server.mappath("dB.mdb")

Set connection = Server.CreateObject("ADODB.Connection")
connection.Open(sConnString)
connection.execute(SQL)
Connection.Close
Set Connection = Nothing

end if

###

Any help would be greatly appreciated.

Thanks in advance
cooperljrh is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 11-13-2006, 12:49 PM Re: Problem adding record to access db
chrishirst's Avatar
Super Moderator

Posts: 13,477
Location: Blackpool. UK
response.write out the SQL string before calling execute so you can see what is being sent to the server and post the output here if you cannot see a problem.


Text values in the string should be surrounded with single quotes otherwise the Access driver could be taking the "/" as a divide operation.
Date literals should be surrounded with "#" as well if you are using date type fields.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Problem adding record to access db
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12955 seconds with 12 queries