Re: Insert data into Access database
- From: "Grant Merwitz" <grant@xxxxxxxxxxxxx>
- Date: Wed, 10 Aug 2005 14:19:23 +0100
I've had that error before, can't remember exactly how i fixed it.
Just checked the permissions on the Access file, try setting the Security on
either the .mdb file, or the folder its in.
To test, set security to allow full control to everyone, and test it then
"Larry B via DotNetMonster.com" <forum@xxxxxxxxxxxxxxxxx> wrote in message
news:52A27759B1562@xxxxxxxxxxxxxxxxxxxx
> Hello,
>
> I seem to be having a problem with inserting data, from a web form, into
> an
> access database. I have tried
> to do the same thing in a regular windows app, there it works fine, but
> when
> I try to do the same thing in an ASP. NET form I get an error saying the
> 'query needs to be updateable'. The code is identical, except for a little
> difference in the connection string.
>
> Here is my code in the web form, from a button click handler:
>
> OleDbConnection DBConnection = new
> OleDbConnection("Provider=Microsoft.JET.
> OLEDB.4.0;Data Source=" + this.Server.MapPath("JobRegistry.mdb") + ";");
> OleDbCommand cmd = new OleDbCommand("INSERT INTO Jobs (job_id, job_name,
> job_num, div_id, builder, location) VALUES ('0000-000', 'test1', '3999',
> '2',
> 'OK', 'OKLOCATION')", DBConnection);
> cmd.Connection.Open();
> cmd.ExecuteNonQuery();
> cmd.Connection.Close();
>
> This generates the error message I receive:
> 'Operation must use an updateable query'
>
>
>
> This is the same code used in the windows app, from a button click
> handler:
>
> OleDbConnection DBConnection = new
> OleDbConnection("Provider=Microsoft.JET.
> OLEDB.4.0;DataSource=JobRegistry.mdb");
> OleDbCommand cmd = new OleDbCommand("INSERT INTO Jobs (job_id, job_name,
> job_num, div_id, builder, location) VALUES ('0000-000', 'test1', '3999',
> '2',
> 'OK', 'OKLOCATION')", DBConnection);
> cmd.Connection.Open();
> cmd.ExecuteNonQuery();
> cmd.Connection.Close();
>
> This works fine.
>
> Seems I am missing missing something somewhere. This is basically my first
> attempt at working with a database source using ASP.NET and a web form.
> Any
> help would be appreciated!
>
> Thank You
> Larry Burnett
.
- References:
- Insert data into Access database
- From: Larry B via DotNetMonster.com
- Insert data into Access database
- Prev by Date: Re: Insert data into Access database
- Next by Date: Re: Can we make confirm as a common function
- Previous by thread: Re: Insert data into Access database
- Next by thread: Re: Insert data into Access database
- Index(es):
Relevant Pages
|