Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Operation must use an updateable query??????

Status
Not open for further replies.

knaya

MIS
Dec 4, 2003
51
US
how can inserting new records into an access database be so hard from an asp.net page..first i had major problems connecting to it and now i can read data from it but i cant insert new data in any table, it keeps saying "System.Data.OleDb.OleDbException: Operation must use an updateable query." does anyone have any idea how to do this. I read you have to give all users full access to the mdb.file but where do you do this. the database is on a host server.. Helppppp someone, anyone, this is becoming very fustrating and the funny part is everone i know seems to also have this problem, i'm actually helping them find the problem :) Gracious
 
I have gotten this error when the DB didn't support nested SELECTS within an UPDATE statement. I had to rewrite it like this (where HeightRange is from another table):
Code:
UPDATE tbl_User
(Name, Age, HeightRange)
VALUES (
   SELECT ?, ?, HeightRange
   FROM tbl_HeightRange
   WHERE HeightRangeID = ?)
);
I would then supply parameters for the name, age, and HeightRangeID.

I *was* trying to do it like this, which didn't work:
Code:
UPDATE tbl_User
(Name, Age, HeightRange)
VALUES (
     ?, ?, 
     (SELECT HeightRange
      FROM tbl_HeightRange
      WHERE HeightRangeID = ?)
);

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Corran007,
my code is:
<%@ Import NameSpace="System.Data" %>
<%@ Import NameSpace="System.Data.OleDb" %>
<Script runat="server">

Sub Button_Click (s as object, e as EventArgs)
Dim conbooks As OleDbConnection
Dim strInsert as string
Dim cmdInsert As OleDbCommand


conbooks = new OleDbConnection ( "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=E:\accounts\k-rozcom\books.mdb")
strInsert = "Insert Into logininfo (, [password]) Values (?, ?)"
cmdInsert = new OleDbCommand (strInsert, conbooks)

cmdInsert.Parameters.Add ("@newemail", txtemail.text)
cmdInsert.Parameters.Add ("@newpassword", txtuser.text)

conbooks.Open()
cmdInsert.ExecuteNonQuery()
conbooks.Close()
End Sub
</Script>
<HTML>
<HEAD>
<title>yepa</title>
</HEAD>
<body>
<form runat="server">
<h1>Register</h1>
<b>email:</b>
<asp:TextBox ID="txtemail" Runat="server" />
<b>username:</b>
<asp:TextBox ID="txtuser" Runat="server" />
<asp:Button Text="register" Runat="server" OnClick = "Button_click" />
</form>
</body>
</HTML>

Helpppp, pleaseeee
 
Antoher very common reasoning to this very broad error is the permissions on the DB or directory containing the DB.

Although these threads revert to Classic ASP the same will apply for attempting to rid this error here

thread333-771402



___________________________________________________________________

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
 
Your fieldname "NAME" is a reserved word in Access.

HTH,
Keith
 
Keith,
I have no field called "name".. i've given up on this. Onpnt is right (i believe), it has somethig to do with permissions. I couldnt set the permissions on my computer cause its a fat system. I GIVEEE UPPPPPP :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top