Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 791
  • Last Modified:

Operation must use an updateable query

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
johny_bravo1
Asked:
johny_bravo1
  • 7
  • 4
  • 2
  • +1
2 Solutions
 
SNilssonCommented:
0
 
rockiroadsCommented:
can u post the sql ? does your sql include a select using aggregate functions or something?

0
 
johny_bravo1Author Commented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
rockiroadsCommented:
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
 
johny_bravo1Author Commented:
actually it works fine on local machine but not on web server.

0
 
EspavoCommented:
Does your Access DB have Read and Write permissions on the server?
0
 
johny_bravo1Author Commented:
on the server????
Well I have uploaded the same mdb on the server.
0
 
johny_bravo1Author Commented:
0
 
rockiroadsCommented:
if it works on your box then sounds like permissions. did u look a bit more at the last link I gave?
0
 
rockiroadsCommented:
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
 
johny_bravo1Author Commented:
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
 
johny_bravo1Author Commented:
Ok I am not getting that Security tab on the FTP  but I am getting it on my machine.
0
 
EspavoCommented:
You may need to contact the Server Administrator and ask him/her to enable Write permissions (full permissions) on your .MDB
0
 
johny_bravo1Author Commented:
Ok I'll post back if anything is updated
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

  • 7
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now