找高手帮忙看看这个错误具体原因
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsFormsApplication1
{
public partial class xgmm : Form
{
string username = login.uname;//获得到当前用户名
string connectionString;
// SqlConnection conn;
public xgmm()
{
InitializeComponent();
//禁止最大化
this.MaximizeBox = false;
ymmtextbox_xgmm.PasswordChar = '*';
xmmtextBox_xgmm.PasswordChar = '*';
zsrxmmtextBox_xgmm.PasswordChar = '*';
zsrxmmtextBox_xgmm.PasswordChar = '*';
connectionString = Properties.Settings.Default.SSGLConnectionString;
}
//??????????????
//问题 输入原先密码不正确怎么办
private void qdbutton_xgmm_Click(object sender, EventArgs e)
{
// string passwd = "123456";
using (SqlConnection conn = new SqlConnection(connectionString))
{
try
{
conn.Open();
}
catch
{
MessageBox.Show("数据库连接失败!");
}
//输入的密码合法性判断
if (ymmtextbox_xgmm.Text == "" || xmmtextBox_xgmm.Text == "" || zsrxmmtextBox_xgmm.Text == "")
{
MessageBox.Show("原密码or新密码or确认密码不能为空!");
}
else
{
//查询该用户以及密码是否在数据库中存在
string sql = "select * from YHB where YHM=@yhm and YMM=@ymm";
SqlCommand comm = new SqlCommand(sql,conn);
comm.Parameters.Add("@yhm", SqlDbType.NVarChar).Value = username;
comm.Parameters.Add("@ymm", SqlDbType.NVarChar).Value =ymmtextbox_xgmm.Text;
SqlDataReader dr = comm.ExecuteReader();
if (dr.HasRows)//用户和密码都存在
{
dr.Dispose();
//插入新的密码数据
string sql1 = "insert into YHB (YMM) values(@ymm)";
SqlCommand ss = new SqlCommand(sql1, conn);
ss.Parameters.Add("@ymm", SqlDbType.NVarChar).Value = zsrxmmtextBox_xgmm.Text;
MessageBox.Show(zsrxmmtextBox_xgmm.Text);
int n = ss.ExecuteNonQuery();//该句报错。。
if (n > 0)
{
MessageBox.Show("密码修改成功!");
ss.Dispose();
this.Close();
}
else
{
MessageBox.Show("密码修改失败!");
}
}
else
{
MessageBox.Show("原密码不正确!");
}
}//else
conn.Close();
}//using
}
private void qxbutton_xgmm_Click(object sender, EventArgs e)
{
this.Close();
}
private void xgmm_Load(object sender, EventArgs e)
{
}
}
}
这事错误截图。

[解决办法]
value钱加空格。。。。。。
我也刚做了一个c#写入access数据库的。一开始很蛋疼。。。。
语法,逗号,空格,引号。。。。
一个都不能错。。。
不然报的错跟你的实际错误会有出入的。。。