473,804 Members | 3,194 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OleDb & ASP.NET - Exception - Operation must use an updateable query

mp
Hi,

I have following problem:

Operation must use an updateable query

I have use OleDb, C# and ASP.NET and MS Access DB named pubs.

Code:

private void Button1_Click(o bject sender, System.EventArg s e)
{
@OleDbConnectio n thisConnection = new OleDbConnection (
@"Provider=Micr osoft.Jet.OLEDB .4.0;" +
@"Data Source=" +
@"C:\base\pubs. mdb");

String insertCmd = "insert into Authors (au_id, au_lname) values (@Id,
@LName)";

OleDbCommand myCommand = new OleDbCommand(in sertCmd, thisConnection) ;
myCommand.Param eters.Add(new OleDbParameter( "@Id", OleDbType.VarCh ar,
11));
myCommand.Param eters["@Id"].Value = txtID.Text;
/*Server.HtmlEnc ode(txtID.Text) ;*/

myCommand.Param eters.Add(new OleDbParameter( "@LName", OleDbType.VarCh ar,
40));
myCommand.Param eters["@LName"].Value = txtLName.Text; /*
Server.HtmlEnco de(txtLName.Tex t); */
myCommand.Conne ction.Open();

//myCommand.Execu teNonQuery();
try
{
myCommand.Execu teNonQuery();
}
catch (OleDbException xx)
{
// Exception
lblMessage.Text = "Insert Data Failed - " + xx.Message;
}
myCommand.Conne ction.Close();
}

Thanks
Nov 16 '05 #1
2 2629
mp
Hi,

I have put this example on web and everything works but localy doesn't.

Do you have ideas why does not work locally?

Thanks,

Mirko

"mp" <pl****@volja.n et> wrote in message
news:OH******** ********@TK2MSF TNGP09.phx.gbl. ..
Hi,

I have following problem:

Operation must use an updateable query

I have use OleDb, C# and ASP.NET and MS Access DB named pubs.

Code:

private void Button1_Click(o bject sender, System.EventArg s e)
{
@OleDbConnectio n thisConnection = new OleDbConnection (
@"Provider=Micr osoft.Jet.OLEDB .4.0;" +
@"Data Source=" +
@"C:\base\pubs. mdb");

String insertCmd = "insert into Authors (au_id, au_lname) values (@Id,
@LName)";

OleDbCommand myCommand = new OleDbCommand(in sertCmd, thisConnection) ;
myCommand.Param eters.Add(new OleDbParameter( "@Id", OleDbType.VarCh ar,
11));
myCommand.Param eters["@Id"].Value = txtID.Text;
/*Server.HtmlEnc ode(txtID.Text) ;*/

myCommand.Param eters.Add(new OleDbParameter( "@LName", OleDbType.VarCh ar, 40));
myCommand.Param eters["@LName"].Value = txtLName.Text; /*
Server.HtmlEnco de(txtLName.Tex t); */
myCommand.Conne ction.Open();

//myCommand.Execu teNonQuery();
try
{
myCommand.Execu teNonQuery();
}
catch (OleDbException xx)
{
// Exception
lblMessage.Text = "Insert Data Failed - " + xx.Message;
}
myCommand.Conne ction.Close();
}

Thanks

Nov 16 '05 #2
mp
Hi,

I have put this example on web and everything works but localy doesn't.

Do you have ideas why does not work locally?

Thanks,

Mirko

"mp" <pl****@volja.n et> wrote in message
news:OH******** ********@TK2MSF TNGP09.phx.gbl. ..
Hi,

I have following problem:

Operation must use an updateable query

I have use OleDb, C# and ASP.NET and MS Access DB named pubs.

Code:

private void Button1_Click(o bject sender, System.EventArg s e)
{
@OleDbConnectio n thisConnection = new OleDbConnection (
@"Provider=Micr osoft.Jet.OLEDB .4.0;" +
@"Data Source=" +
@"C:\base\pubs. mdb");

String insertCmd = "insert into Authors (au_id, au_lname) values (@Id,
@LName)";

OleDbCommand myCommand = new OleDbCommand(in sertCmd, thisConnection) ;
myCommand.Param eters.Add(new OleDbParameter( "@Id", OleDbType.VarCh ar,
11));
myCommand.Param eters["@Id"].Value = txtID.Text;
/*Server.HtmlEnc ode(txtID.Text) ;*/

myCommand.Param eters.Add(new OleDbParameter( "@LName", OleDbType.VarCh ar, 40));
myCommand.Param eters["@LName"].Value = txtLName.Text; /*
Server.HtmlEnco de(txtLName.Tex t); */
myCommand.Conne ction.Open();

//myCommand.Execu teNonQuery();
try
{
myCommand.Execu teNonQuery();
}
catch (OleDbException xx)
{
// Exception
lblMessage.Text = "Insert Data Failed - " + xx.Message;
}
myCommand.Conne ction.Close();
}

Thanks

Nov 16 '05 #3

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

Similar topics

6
7564
by: ano1optimist | last post by:
I have been running these queries in Access 2000 with no problems. This week, I had to install Access 2003 to create some runtime versions for another application, and now I keep getting "operation must be an updateable query" messages when I try to run the same old queries. Here is a sample of one that is no longer working: UPDATE Personnel INNER JOIN dbo_personnel ON .= dbo_personnel. SET personnel. = dbo_personnel.,...
1
321
by: mp | last post by:
Hi, I have following problem: Operation must use an updateable query I have use OleDb, C# and ASP.NET and MS Access DB named pubs. Code:
2
419
by: mp | last post by:
Hi, I have following problem: Operation must use an updateable query I have use OleDb, C# and ASP.NET and MS Access DB named pubs. Code:
11
3971
by: Arpan | last post by:
I have always been working with SQL Server 2005 for ASP.NET apps but due to some reasons, had to revert back to MS-Access 2000. When I try to insert/update a MS-Access DB table (MDB), ASP.NET generates the following error: Operation must use an updateable query. pointing to a line that says
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10077
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9152
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2991
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.