Hi,
Kan følgende fejlmelding betyde manglende skriveadgang til databasen? Eller
er der noget galt i koden (se herunder)
Error Type:
Microsoft JET Database Engine (0x80004005)
Operation must use an updateable query.
--
Med venlig hilsen
Lars Klingenberg
[lklingenberg@ifi.ku.dk]
ASP-kode:
<%
dim strInsert, strValues, adCmdText, objConn, vCS, oRS, maxnum
if request.form("Action") = "Add" then
'building SQL strings with required fields
strInsert = "INSERT INTO tblKalender
(dato_start,dato_slut,klok,art,lokale,url,info"
strValues = "VALUES('" & cstr(request.form("dato_start")) & "','" &
cstr(request.form("dato_slut")) & "','" & cstr(request.form("klok")) & "','"
& cstr(request.form("art")) & "','" & cstr(request.form("lokale")) & "','" &
cstr(request.form("url")) & "','" & cstr(request.form("info")) & "'"
'create and open the database object
set objConn = server.createobject("ADODB.Connection")
vCS = "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=h:\inetpub\wwwroot\naturdidak\database\cnddb.mdb;"
objConn.connectionstring = vCS
objConn.Open
set objCmd = server.createobject("ADODB.Command")
'set the command object properties
adCmdText = 1
Set objCmd.ActiveConnection = objConn
objCmd.CommandText = strInsert & ") " & strValues & ")"
objCmd.CommandType = adCmdText
objCmd.Execute
'display the insert string
Response.Write "Aktiviteten er blevet optaget i databasen med følgende
oplysninger:<P>"
Response.Write "<b>" & strInsert & ")<br>" & strValues & ")</b>"
End If
'Get Autonumberfield
strInsert = "SELECT Max(ID) AS maxnum FROM tblKalender"
set oRS = objConn.Execute(strInsert)
maxnum = oRS("maxnum").Value
Response.Write "<p>Aktiviteten er tildelt nummeret: <b>" & maxnum &
"</p>"
'Close and dereference database objects
Set objCmd = Nothing
objConn.Close
Set objConn = Nothing
Set strInsert = Nothing
Set strValues = Nothing
Set adCmdText = Nothing
Set vCS = Nothing
Set oRS = Nothing
%>
|