Solved

Operation must use an updateable query

Posted on 2009-05-10
14
783 Views
Last Modified: 2013-11-07
Hi,,
I am trying to insert  data in access table in my asp.net application.
Locally it is working fine but on my web server it is throwing the above exception.
What is the cause of this?
0
Comment
Question by:johny_bravo1
  • 7
  • 4
  • 2
  • +1
14 Comments
 
LVL 8

Expert Comment

by:SNilsson
ID: 24347271
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 24347309
can u post the sql ? does your sql include a select using aggregate functions or something?

0
 
LVL 8

Author Comment

by:johny_bravo1
ID: 24347344
string connectionString = string.Format(ConfigurationSettings.AppSettings["myconn"], Server.MapPath(ConfigurationSettings.AppSettings["finddb"]));
        OleDbConnection con = new OleDbConnection(connectionString);
        con.Open();

        string name = this.txtName.Text;
        string cname = this.txtCompName.Text;
        string number1 = this.txtContactNumber.Value;
        string email1 = this.txtEmail.Text;
        string address = this.txtAddress.Text;

        string sqlinsert = "insert into MemberData (MName,CName,Number1,Email1,Address)values ('" + name + "','" + cname + "','" + number1 + "','" + email1 + "','" + address + "')";
        OleDbCommand cmdinsert = new OleDbCommand(sqlinsert, con);
        cmdinsert.ExecuteNonQuery();
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 65

Expert Comment

by:rockiroads
ID: 24347388
well from looking at your query, I cant see anything wrong with it

what datatype is Number1, is it text? if its numeric then remove the single quotes

 string sqlinsert = "insert into MemberData (MName,CName,Number1,Email1,Address)values ('" + name + "','" + cname + "'," + number1 + ",'" + email1 + "','" + address + "')";


Have u looked into using parameters ? have a look at how its done here http://aspnet101.com/aspnet101/tutorials.aspx?id=1

Also, look at this. It is talking about permissions http://forums.asp.net/t/154273.aspx
0
 
LVL 8

Author Comment

by:johny_bravo1
ID: 24347402
actually it works fine on local machine but not on web server.

0
 
LVL 10

Expert Comment

by:Espavo
ID: 24347403
Does your Access DB have Read and Write permissions on the server?
0
 
LVL 8

Author Comment

by:johny_bravo1
ID: 24347414
on the server????
Well I have uploaded the same mdb on the server.
0
 
LVL 8

Author Comment

by:johny_bravo1
ID: 24347416
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 24347425
if it works on your box then sounds like permissions. did u look a bit more at the last link I gave?
0
 
LVL 65

Accepted Solution

by:
rockiroads earned 300 total points
ID: 24347431
the instructions here http://forums.asp.net/t/1083195.aspx 

It's a permissions issue.  You have to apply Modify permissions to the ASPNET account on your Access database.  Right click on the file, select the Security tab, then Add to find the ASPNET account
0
 
LVL 8

Author Comment

by:johny_bravo1
ID: 24347435
ya but I am not authorised to do anything on web server.

It is a third party server.

I can create a DSN for access.That's it what I can do there.


0
 
LVL 8

Author Comment

by:johny_bravo1
ID: 24347448
Ok I am not getting that Security tab on the FTP  but I am getting it on my machine.
0
 
LVL 10

Assisted Solution

by:Espavo
Espavo earned 200 total points
ID: 24347459
You may need to contact the Server Administrator and ask him/her to enable Write permissions (full permissions) on your .MDB
0
 
LVL 8

Author Comment

by:johny_bravo1
ID: 24347518
Ok I'll post back if anything is updated
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question