Solved

Operation must use an updateable query

Posted on 2009-05-10
14
784 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

749 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