473,472 Members | 1,882 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Can't insert data to MS Access 2003

Hi,

I have a C# application with MS access 2003 as DB for password protection.
The DB has two tables: one is Logins, the other Visits.

When I do the reading as below:
SELECT Password FROM Logins WHERE Username ='dale'

it is a success.
INSERT INTO Visits (Email,LoginDate,ReferPage,LoginOK,LoginPass,IP) VALUES
('dale',#8/13/2005 11:46:41
AM#,'/passwordProtectCSharp/privatePage.aspx',1,'dale1','127.0.0.1')

it always gives me an exception as below:
Operation must use an updatable query.

The codes are:
try
{
// write the visit log entry
dbConn = new OleDbConnection(sConn);
dbConn.Open();
dbCmd = new OleDbCommand(sSQL, dbConn);
dbCmd.ExecuteNonQuery();
}
catch (Exception e)
{
Debug.WriteLine(e.Message);
}
when I write the DB as below:

I want to run the "insert" in MS access separately for testing, can not find
a way to do so. Any suggestions are welcome. -Dale
Nov 17 '05 #1
5 2216
Do you have write permissions on the folder? Is the database file read
only?

These are the two most likely reasons you are getting this error.
Particularly
if you are running this via an ASP.NET application because the http
request is not run under your windows account by default.

--
Robbe Morris - 2004/2005 Microsoft MVP C#

Earn money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp

"dale zhang" <da*******@discussions.microsoft.com> wrote in message
news:36**********************************@microsof t.com...
Hi,

I have a C# application with MS access 2003 as DB for password protection.
The DB has two tables: one is Logins, the other Visits.

When I do the reading as below:
SELECT Password FROM Logins WHERE Username ='dale'

it is a success.
INSERT INTO Visits (Email,LoginDate,ReferPage,LoginOK,LoginPass,IP) VALUES
('dale',#8/13/2005 11:46:41
AM#,'/passwordProtectCSharp/privatePage.aspx',1,'dale1','127.0.0.1')

it always gives me an exception as below:
Operation must use an updatable query.

The codes are:
try
{
// write the visit log entry
dbConn = new OleDbConnection(sConn);
dbConn.Open();
dbCmd = new OleDbCommand(sSQL, dbConn);
dbCmd.ExecuteNonQuery();
}
catch (Exception e)
{
Debug.WriteLine(e.Message);
}
when I write the DB as below:

I want to run the "insert" in MS access separately for testing, can not
find
a way to do so. Any suggestions are welcome. -Dale

Nov 17 '05 #2
Hi,

Check:

http://support.microsoft.com/default...;EN-US;Q175168

Regards - Octavio

"dale zhang" <da*******@discussions.microsoft.com> escribió en el mensaje
news:36**********************************@microsof t.com...
Hi,

I have a C# application with MS access 2003 as DB for password protection.
The DB has two tables: one is Logins, the other Visits.

When I do the reading as below:
SELECT Password FROM Logins WHERE Username ='dale'

it is a success.
INSERT INTO Visits (Email,LoginDate,ReferPage,LoginOK,LoginPass,IP) VALUES
('dale',#8/13/2005 11:46:41
AM#,'/passwordProtectCSharp/privatePage.aspx',1,'dale1','127.0.0.1')

it always gives me an exception as below:
Operation must use an updatable query.

The codes are:
try
{
// write the visit log entry
dbConn = new OleDbConnection(sConn);
dbConn.Open();
dbCmd = new OleDbCommand(sSQL, dbConn);
dbCmd.ExecuteNonQuery();
}
catch (Exception e)
{
Debug.WriteLine(e.Message);
}
when I write the DB as below:

I want to run the "insert" in MS access separately for testing, can not
find
a way to do so. Any suggestions are welcome. -Dale

Nov 17 '05 #3
thank you for the suggestions. The 1st 2 questions are not the case.

I am using asp.net. this does ring my bell. when i learnt .net, we used sql
DB. I recall we needed to add some writeable options in sql manager.

But I am using MS access now, how do I add writeable options?

-Dale
"Robbe Morris [C# MVP]" wrote:
Do you have write permissions on the folder? Is the database file read
only?

These are the two most likely reasons you are getting this error.
Particularly
if you are running this via an ASP.NET application because the http
request is not run under your windows account by default.

--
Robbe Morris - 2004/2005 Microsoft MVP C#

Earn money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp

"dale zhang" <da*******@discussions.microsoft.com> wrote in message
news:36**********************************@microsof t.com...
Hi,

I have a C# application with MS access 2003 as DB for password protection.
The DB has two tables: one is Logins, the other Visits.

When I do the reading as below:
SELECT Password FROM Logins WHERE Username ='dale'

it is a success.
INSERT INTO Visits (Email,LoginDate,ReferPage,LoginOK,LoginPass,IP) VALUES
('dale',#8/13/2005 11:46:41
AM#,'/passwordProtectCSharp/privatePage.aspx',1,'dale1','127.0.0.1')

it always gives me an exception as below:
Operation must use an updatable query.

The codes are:
try
{
// write the visit log entry
dbConn = new OleDbConnection(sConn);
dbConn.Open();
dbCmd = new OleDbCommand(sSQL, dbConn);
dbCmd.ExecuteNonQuery();
}
catch (Exception e)
{
Debug.WriteLine(e.Message);
}
when I write the DB as below:

I want to run the "insert" in MS access separately for testing, can not
find
a way to do so. Any suggestions are welcome. -Dale


Nov 17 '05 #4
The link posted from the other guy dealt with classic ASP but is
still applicable. Check to see which windows account your ASP.NET
accounts are running under and make sure that folder and the database
file itself have write permissions. They are probably being handled
by the "Network Service" windows account.

--
Robbe Morris - 2004/2005 Microsoft MVP C#

Earn money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp

"dale zhang" <da*******@discussions.microsoft.com> wrote in message
news:6B**********************************@microsof t.com...
thank you for the suggestions. The 1st 2 questions are not the case.

I am using asp.net. this does ring my bell. when i learnt .net, we used
sql
DB. I recall we needed to add some writeable options in sql manager.

But I am using MS access now, how do I add writeable options?

-Dale
"Robbe Morris [C# MVP]" wrote:
Do you have write permissions on the folder? Is the database file read
only?

These are the two most likely reasons you are getting this error.
Particularly
if you are running this via an ASP.NET application because the http
request is not run under your windows account by default.

--
Robbe Morris - 2004/2005 Microsoft MVP C#

Earn money answering .NET Framework
messageboard posts at EggHeadCafe.com.
http://www.eggheadcafe.com/forums/merit.asp

"dale zhang" <da*******@discussions.microsoft.com> wrote in message
news:36**********************************@microsof t.com...
> Hi,
>
> I have a C# application with MS access 2003 as DB for password
> protection.
> The DB has two tables: one is Logins, the other Visits.
>
> When I do the reading as below:
> SELECT Password FROM Logins WHERE Username ='dale'
>
> it is a success.
> INSERT INTO Visits (Email,LoginDate,ReferPage,LoginOK,LoginPass,IP)
> VALUES
> ('dale',#8/13/2005 11:46:41
> AM#,'/passwordProtectCSharp/privatePage.aspx',1,'dale1','127.0.0.1')
>
> it always gives me an exception as below:
> Operation must use an updatable query.
>
> The codes are:
> try
> {
> // write the visit log entry
> dbConn = new OleDbConnection(sConn);
> dbConn.Open();
> dbCmd = new OleDbCommand(sSQL, dbConn);
> dbCmd.ExecuteNonQuery();
> }
> catch (Exception e)
> {
> Debug.WriteLine(e.Message);
> }
> when I write the DB as below:
>
> I want to run the "insert" in MS access separately for testing, can not
> find
> a way to do so. Any suggestions are welcome. -Dale


Nov 17 '05 #5
Thanks a lot. The link did help to solve the problem.

-Dale

"Octavio Hernandez" wrote:
Hi,

Check:

http://support.microsoft.com/default...;EN-US;Q175168

Regards - Octavio

"dale zhang" <da*******@discussions.microsoft.com> escribió en el mensaje
news:36**********************************@microsof t.com...
Hi,

I have a C# application with MS access 2003 as DB for password protection.
The DB has two tables: one is Logins, the other Visits.

When I do the reading as below:
SELECT Password FROM Logins WHERE Username ='dale'

it is a success.
INSERT INTO Visits (Email,LoginDate,ReferPage,LoginOK,LoginPass,IP) VALUES
('dale',#8/13/2005 11:46:41
AM#,'/passwordProtectCSharp/privatePage.aspx',1,'dale1','127.0.0.1')

it always gives me an exception as below:
Operation must use an updatable query.

The codes are:
try
{
// write the visit log entry
dbConn = new OleDbConnection(sConn);
dbConn.Open();
dbCmd = new OleDbCommand(sSQL, dbConn);
dbCmd.ExecuteNonQuery();
}
catch (Exception e)
{
Debug.WriteLine(e.Message);
}
when I write the DB as below:

I want to run the "insert" in MS access separately for testing, can not
find
a way to do so. Any suggestions are welcome. -Dale


Nov 17 '05 #6

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

Similar topics

0
by: ImraneA | last post by:
Hi there I had pleasure of upsizing Access v97 db to Access v2K/SQL 2K. Wish to provide some knowledge gained back to community - hopefully help others. 1.Question how do you test stored...
2
by: teddysnips | last post by:
I have an application that does some data manipulation of some tables to format a table for a report. 1. First I open the table that gives me the parameters for some later queries strSQL =...
2
by: raghunadhs | last post by:
Hi All, i have some simple scripts( which may have some insert statements, update statements etc). these scripts were written in Sql server 2000. now i want to use the same scripts in Access. (since...
5
by: betaphase | last post by:
I am new to Access and I'm having trouble with a database someone else created. I am wondring why I am not being able to insert more than 255 characters to a memo field in Access 2003. We need a...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.