这段代码有什么问题: [英] What's the problem in this code:

查看:70
本文介绍了这段代码有什么问题:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此代码中的问题是什么:

What's the problem in this code:

OleDbConnection cn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source="
                                                                        + Application.StartupPath + "/Database/DB.accdb;Jet OLEDB:Database Password=123");
OleDbCommand cmd = new OleDbCommand("update tblUP Set Password=@UP,UserType=@UT,FirstName=@FN,LastName=@LN where UserName=@UN",cn);
cmd.Parameters.AddWithValue("@UP", txtUP.Text);
cmd.Parameters.AddWithValue("@UT", chkUT.Checked);
cmd.Parameters.AddWithValue("@FN", txtFN.Text);
cmd.Parameters.AddWithValue("@LN", txtLN.Text);
cmd.Parameters.AddWithValue("@UN", txtUN.Text);
cn.Open();
cmd.ExecuteNonQuery();
cn.Close();



编译器答案:语法错误。

谢谢。


compiler answer: syntax error.
thanks.

推荐答案

在更新查询之前使用cn.open
use cn.open before the update query


大家好。

i发现问题;

只是,改变下面的声音。

密码= @ UP ------------->通过= @ UP

谢谢。
hi everyone.
i found the problem;
just, change the bellow.
Password=@UP -------------> Pass=@UP
thanks.


这篇关于这段代码有什么问题:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆