http://www.aspfaq.com/show.asp?id=2062 - updatable cursor
http://www.aspfaq.com/show.asp?id=2009 - 80004005 errors
HTH,
Bob Barrows
PS. You may want to consider parameterizing this query, either using a saved
parameter query, or by parameterizing your SQL statement using "?"
placeholders and Command object per the technique described by Daniel Bush
in this thread:
http://tinyurl.com/jiay
Myself, I prefer the saved parameter query approach. Create a saved query
(call it qInsChkReq) using this SQL:
INSERT INTO tblCheck_Request (Department_ID, Authorizer_ID,
Requester_ID, Payee, Check_Reason, Amount, Deadline_Date, Yacht)
VALUES ([p1], [p2], [p3], [p4], [p5], [p6], [p7], [p8])
Note: no delimiters. Using this technique, you do not have to worry about
delimiting strings and dates. When you run this query in Access (which you
should always do to detect syntax errors), you will be prompted for the 8
parameter values. In ASP, you will provide these values in your code.
In ASP, do this after opening your connection:
cnn.qInsChkReq Department_ID, Authorizer_ID, Requester_ID, _
Payee, Check_Reason, Amount, Deadline_Date, Yacht
That's it. Again: notice that no delimiters or concatenation had to be used.
And, you don't have to worry about escaping literal quotes in your string
data.
You still have to take care of the permissions problem discussed in the
aspfaq articles.
jason wrote:
> I am picking up an error message on a straightforward INSERT - do I
> need an optimistic-type to get this working....here is is the error:
>
> Microsoft JET Database Engine error '80004005' Operation must use an
> updateable query. /catamaranco/accounts/email_inc.asp, line 264
>
>
> Set cnn = CreateObject("ADODB.Connection")
> strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
> Server.MapPath("../database/acc.mdb") '//This one is for Access
> 2000/2002 cnn.Open(strCon)
>
> SQL = "INSERT INTO tblCheck_Request (Department_ID, Authorizer_ID,
> Requester_ID, Payee, Check_Reason, Amount, Deadline_Date, Yacht)
> VALUES ("
>
> SQL=SQL & "'" & Department_ID & "', "
>
> SQL=SQL & "'" & Authorizer_ID & "', "
>
> SQL=SQL & "'" & Requester_ID & "', "
>
> SQL=SQL & "'" & Payee & "', "
>
> SQL=SQL & "'" & Check_Reason & "', "
>
> SQL=SQL & "'" & Amount & "', "
>
> SQL=SQL & "'" & Deadline_Date & "', "
>
> SQL=SQL & "'" & Yacht & "')"
>
> Response.Write SQL
> Set rs = cnn.Execute(SQL)