Web Development

General discussion


ASP.NET (c#)

By studynsunil ·
My name is vatsal from baroda, gujarat,india.
I have problem in ASP.Net , when i insert record in MSAccess through ASP.net , it display an error : you must use updateable query
I have pentiumIV pc & loading operating system is XP professional
code is :
private void insert_click()
oledbconnection connection=("provider=");
oledbCommand cmd= new oledbCommand("insert into tcategory(cid,cname) values(@cid,@cname)",connection);
This coding is right or wrong please inform me.
if you know the solution please send the solution

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by ignatandrei In reply to ASP.NET (c#)

as far as I know, access(jet) does not support parameters in command
So you must put into the sql, maybe doubling the quotes

Collapse -

by careed In reply to ASP.NET (c#)

The OLE DB .NET provider does not support named parameters. So, you need to change your insert statement to use question marks ("?") in place of the named parameters. Then, add the parameters in the correct order. Additionally, you might verify that the column cid is not an autonumber because this should not add to an insert statement since it'll be updated automatically when the record is added.

Collapse -

by Y2KSUNDARA In reply to ASP.NET (c#)

Looks like a primary key violation @cid

Collapse -

by Marwa In reply to ASP.NET (c#)

I faced the same problem with my application, You can solve it by adding IUSER_Machinename and ASPNET to security users list of your database file, and give them all permissions Write- Modify- Read.

Related Discussions

Related Forums