开发者

INSERT INTO statement for Access in ASP.NET

开发者 https://www.devze.com 2023-01-27 23:21 出处:网络
I am developing a website. My connection string in web.config is as below: \"add name=\"MyDbConn1\" connectionString=\"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Program Files\\QWIN 2000Q\\Dat

I am developing a website.

My connection string in web.config is as below:

"add name="MyDbConn1" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\QWIN 2000Q\Database\qwin_5501q.mdb;""

I already retrieve several times from that database using that connection string. They are working.

But When I insert into a table, error pop ups that "syntax error in INSERT INTO statement".

The below is my codes for insert into statement.

command2.Parameters.AddWithValue("@Name", txtUser.Text);
command2.Parameters.AddWithValue("@Password", txtPwd.Text);
command2.Parameters.AddWithValue("@Role", ddlAccess.SelectedItem.ToString());
string abc = "Insert into Report_User (Name, Password, Role) VALUES (@Name,@Password,@Role);";

When I run that statement in the Microsoft Access, there is no er开发者_开发知识库ror.

Anyone?

Is there any folder sharing permission or some sort??


Replace SQL paramter names a la @Name with OleDB-specific parameter placeholder ?

Insert into Report_User (Name, Password, Role) VALUES (?, ?, ?);

change command2.Parameters.Add(..) accordingly.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号