473,320 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Is there anything wrong with my insert code?

hello guys, i'm having a very strange problem, this is a
simple insert code. andthe insert stmt has NO problem cos
i've tried it on my access table.

and heres the error msg

Operation must use an updateable query.
Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and where
it originated in the code.

Exception Details: System.Data.OleDb.OleDbException:
Operation must use an updateable query.

Source Error:
Line 31: objCommand = New OleDbCommand("INSERT
INTO DailyUpdates(content) VALUES('HELLO')", objConn)
Line 32: objCommand.Connection.Open()
Line 33: objCommand.ExecuteReader()
Line 34: objCommand.Connection.Close()
Line 35: End Sub

BELOW HERE IS THE CODE WHICH I USE...

Private Sub btnInsert_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btnInsert.Click
Dim objConn As New OleDbConnection
("PROVIDER=Microsoft.Jet.OLEDB.4.0; Data
source=C:\Projects\SomeProject\Data\dailydosedb.md b")
Dim objCommand As OleDbCommand

objCommand = New OleDbCommand("INSERT INTO
DailyUpdates(content) VALUES('HELLO')", objConn)
objCommand.Connection.Open()
objCommand.ExecuteReader()
objCommand.Connection.Close()
End Sub

thanks for helping me out.. once again, thanks in advance.
Nov 17 '05 #1
2 1305
I don't know if you can use ExecuteReader for inserts. You might want to
look at the ExecuteNonQuery method to do your inserts.

HTH,

bill

"Mano kumar" <ma*********@hotmail.com> wrote in message
news:0a****************************@phx.gbl...
hello guys, i'm having a very strange problem, this is a
simple insert code. andthe insert stmt has NO problem cos
i've tried it on my access table.

and heres the error msg

Operation must use an updateable query.
Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and where
it originated in the code.

Exception Details: System.Data.OleDb.OleDbException:
Operation must use an updateable query.

Source Error:
Line 31: objCommand = New OleDbCommand("INSERT
INTO DailyUpdates(content) VALUES('HELLO')", objConn)
Line 32: objCommand.Connection.Open()
Line 33: objCommand.ExecuteReader()
Line 34: objCommand.Connection.Close()
Line 35: End Sub

BELOW HERE IS THE CODE WHICH I USE...

Private Sub btnInsert_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btnInsert.Click
Dim objConn As New OleDbConnection
("PROVIDER=Microsoft.Jet.OLEDB.4.0; Data
source=C:\Projects\SomeProject\Data\dailydosedb.md b")
Dim objCommand As OleDbCommand

objCommand = New OleDbCommand("INSERT INTO
DailyUpdates(content) VALUES('HELLO')", objConn)
objCommand.Connection.Open()
objCommand.ExecuteReader()
objCommand.Connection.Close()
End Sub

thanks for helping me out.. once again, thanks in advance.

Nov 17 '05 #2
Looks to me like you're using an Access database, and it is in a folder that
doesn't have "Modify" file system permission for the user account under
which your ASP.Net app is running.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

"Mano kumar" <ma*********@hotmail.com> wrote in message
news:0a****************************@phx.gbl...
hello guys, i'm having a very strange problem, this is a
simple insert code. andthe insert stmt has NO problem cos
i've tried it on my access table.

and heres the error msg

Operation must use an updateable query.
Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and where
it originated in the code.

Exception Details: System.Data.OleDb.OleDbException:
Operation must use an updateable query.

Source Error:
Line 31: objCommand = New OleDbCommand("INSERT
INTO DailyUpdates(content) VALUES('HELLO')", objConn)
Line 32: objCommand.Connection.Open()
Line 33: objCommand.ExecuteReader()
Line 34: objCommand.Connection.Close()
Line 35: End Sub

BELOW HERE IS THE CODE WHICH I USE...

Private Sub btnInsert_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btnInsert.Click
Dim objConn As New OleDbConnection
("PROVIDER=Microsoft.Jet.OLEDB.4.0; Data
source=C:\Projects\SomeProject\Data\dailydosedb.md b")
Dim objCommand As OleDbCommand

objCommand = New OleDbCommand("INSERT INTO
DailyUpdates(content) VALUES('HELLO')", objConn)
objCommand.Connection.Open()
objCommand.ExecuteReader()
objCommand.Connection.Close()
End Sub

thanks for helping me out.. once again, thanks in advance.

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jim | last post by:
Im getting way too many rows retured..what its trying to do is insert a 0 for revenue for months 7 - 12 (aka July through December) for each of these cost centers for each payor type..Im getting a...
3
by: Matik | last post by:
Hello all, I belive, my problem is probably very easy to solve, but still, I cannot find solution: declare @i int declare @z int create table bubusilala (
2
by: olekristianvillabo | last post by:
The method cursor.executemany is there in order to avoid multiple calls to cursor.execute(). I have tried, with success, to do like every single example (that I have found on the www) on the...
2
by: Jack | last post by:
It appears that RecordsAffected reports the wrong value when a Null integer or date value is inserted using empty quotes. The insert works fine, but RecordsAffected reports 0 instead of 1. Here...
4
by: Hyphessobrycon | last post by:
Private Sub btnrubriekbij_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnrubriekbij.Click 'insert hier Dim cn As New OleDb.OleDbConnection(constr) Dim dc As...
3
by: snowweb | last post by:
I'm creating my first web application in PHP/MySQL, however, when I go to view the database contents, the data has been stored in the wrong columns. I've gone through my insertion code with a fine...
138
by: Ian Boyd | last post by:
i've been thrown into a pit with DB2 and have to start writing things such as tables, indexes, stored procedures, triggers, etc. The online reference is only so helpful. The two pdf manuals are...
3
by: belton180 | last post by:
CODE]../* Program function: Simulate the stack using a stack limit of 10. Display a menu for the the following. Create a stack Insert an item in the stack Pop an item from the stack ...
28
by: hijkl | last post by:
hey guys anything wrong with this code?? if it is then what? int *array(int n){ return new int(n); } int main(){ int *p = array(10); for( int i = 0; i < 10; i++ ) {
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.