---
title: "Problem med att lägga til poster i databas"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/13085-problem-med-att-lägga-til-poster-i-databas"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "His Divine Shadow"
published: "2001-12-08T18:00:00.000Z"
updated: "2001-12-08T20:04:00.000Z"
replies: 4
views: 219
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/13085-problem-med-att-lägga-til-poster-i-databas"
---

# Problem med att lägga til poster i databas

## #1 — His Divine Shadow, 2001-12-08T18:00Z

När jag ska lägga till en post i en databas får jag detta meddelande:

```
Error Type:
Microsoft JET Database Engine (0x80040E09)
Cannot update. Database or object is read-only.
/addst.asp, line 137
```

Linje 137 är:

```
'Use the addnew method of the recordset object to add a record
137 -> rs.addnew
'Set the table column = to my input text box from my form
rs("Author") = Request.Form("Author") 
.....
```

Permalänk: https://www.webforum.nu/p/13085

## #2 — LarsG, 2001-12-08T18:06Z

Hur ser koden där du skapar recordsetet ut?

Permalänk: https://www.webforum.nu/p/300214

## #3 — His Divine Shadow, 2001-12-08T18:14Z

'Declare all local variables
dim conn
dim rs
dim strID
dim strconn

'set a local variable to my DSN-less connection String
strconn = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=G:\\inetpub\\wwwroot\\db\\quotes.mdb;"

'Create the Connection object 
set conn = server.createobject("adodb.connection")
conn.open strconn

'Create the recordset object
set rs = server.createobject("adodb.recordset")
'This statement opens the table so we can add a record notice the addnew 
'The 2, 2 is how the table is opened there are many ways it can be opened
rs.open "Quotes", conn, 2, 2

'Use the addnew method of the recordset object to add a record
rs.addnew
'Set the table column = to my input text box from my form
rs("Author") = Request.Form("Author") 
rs("Email") = Request.Form("Email")
rs("Category") = Request.Form("Category") 
rs("Subcategory") = Request.Form("Subcategory")
rs("Type") = Request.Form("Type")
rs("Quote") = Request.Form("Quote") 
rs.update

'Always! Always set your objects to nothing.  This clears them out of servers memory
'Your network admins will like this
%\>

Permalänk: https://www.webforum.nu/p/300215

## #4 — LarsG, 2001-12-08T19:55Z

Har du skrivrättigheter på databasfilerna?

Permalänk: https://www.webforum.nu/p/300216

## #5 — His Divine Shadow, 2001-12-08T20:04Z

Hmmm... Lite nytt dethär XP och IIS5.
Men jag kollade runt lite och satte "write" rättigheter för alla, nu funkar det...

Konstigt nog behövdes aldrig detta i NT4 som jag suttit med tils nyligen...

Permalänk: https://www.webforum.nu/p/300217

---

Tråden på webben: https://www.webforum.nu/amne/asp/13085-problem-med-att-lägga-til-poster-i-databas
