Re: Insert data into Access database

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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


.



Relevant Pages

  • Re: C4 Hilariousness
    ... submitted via a web form on their corporate web site if you do not ... making someone aware of a potential breach of security is not ... Now I have proof; now I have fun. ... Brian went on and on about how much like a girl your son looked, ...
    (comp.sys.cbm)
  • Re: ASP.NET 2.0 security..
    ... I use the DAAB for data driven apps ... (both Win form and Web form). ... Security, Membership and Role Management". ... How are you going to determine which rights they are entitled to? ...
    (microsoft.public.dotnet.framework.aspnet)
  • Insert data into Access database
    ... access database. ... Here is my code in the web form, ... OleDbConnection DBConnection = new OleDbConnection("Provider=Microsoft.JET. ... Seems I am missing missing something somewhere. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Web Form/Control Security
    ... access a web service? ... I have heard that the windows controls on a web form, ... unlike activeX objects have strict security settings. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Web Forms Data Access
    ... I have a web form that I would like to use to have people post data into an ... MSDE database. ... security does not seem to work unless I create an SQL connection that is ...
    (microsoft.public.vb.database.ado)