标准表达式中数据类型不匹配MyCmd.ExecuteNonQuery(); 100
代码:stringgl_name=this.text_yhm.Text.Trim();stringgl_mima=this.text_mima.Text.Trim();s...
代码:
string gl_name = this.text_yhm.Text.Trim();
string gl_mima = this.text_mima.Text.Trim();
string gl_time = DateTime.Now.ToString();
string SqlAdd = "INSERT INTO admin(admin_yhm,admin_mima,admin_date) values('" + gl_name + "','" + gl_mima + "','" + gl_time + "')";
OleDbCommand MyCmd = new OleDbCommand(SqlAdd, conn);
MyCmd.ExecuteNonQuery();
conn.Close();
Response.Write("<script> alert(\"恭喜您!管理员添加成功!\") </script>");
return;
}
protected void Button2_Click(object sender, EventArgs e)
{
this.text_yhm.Text = "";
this.text_mima.Text = "";
}
} 展开
string gl_name = this.text_yhm.Text.Trim();
string gl_mima = this.text_mima.Text.Trim();
string gl_time = DateTime.Now.ToString();
string SqlAdd = "INSERT INTO admin(admin_yhm,admin_mima,admin_date) values('" + gl_name + "','" + gl_mima + "','" + gl_time + "')";
OleDbCommand MyCmd = new OleDbCommand(SqlAdd, conn);
MyCmd.ExecuteNonQuery();
conn.Close();
Response.Write("<script> alert(\"恭喜您!管理员添加成功!\") </script>");
return;
}
protected void Button2_Click(object sender, EventArgs e)
{
this.text_yhm.Text = "";
this.text_mima.Text = "";
}
} 展开
2个回答
展开全部
把你生成的sql语句放到数据库中执行看看,应该会更准确的提示哪个字段类型错误的
更多追问追答
追问
具体点,不是很懂
追答
你用的数据库应该是SqlServer吧,打开SqlServer的查询分析器,把你的语句SqlAdd的内容,放到查询分析器中执行,注意你别把变量名gl_name那些直接放到里面了,换成它们的值
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询