数据库基础问题,ASP.NET中添加语句的错误

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
using System.Data;

public partial class Uzc : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
    OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("app_data/student.mdb"));
    conn.Open();
    OleDbCommand mycmd = new OleDbCommand();
    string sql = "Insert Into User(Uname,Password,E-mail)Valuse('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox4.Text + "')";
    mycmd.CommandText = sql;
    mycmd.Connection = conn;
    bool dd = true;
    try
    {
        mycmd.ExecuteNonQuery();
    }
    catch
    {
        dd = false;
    }
    finally
    {
        mycmd.Dispose();
        conn.Close();
        conn.Dispose();
    }
    if (dd)
    {
        string strMessage;
        strMessage = "用户昵称:" + TextBox1.Text;
        strMessage = strMessage + "<br>密码:" + TextBox2.Text;
        strMessage = strMessage + "<br>确认密码:" + TextBox3.Text;
        strMessage = strMessage + "<br>电子邮箱:" + TextBox4.Text;
        Label1.Text = strMessage + "<br>" + TextBox1.Text + ",注册成功!";
    }
}
protected void Button2_Click(object sender, EventArgs e)
{
    TextBox1.Text = " ";
    TextBox2.Text = " ";
    TextBox3.Text = " ";
    TextBox4.Text = " ";
}

}

 string sql = "Insert Into User(Uname,Password,E-mail)Valuse('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox4.Text + "')";

他总是说我添加语句错误,可是我都是改了好几遍都还是这个错误。

3个回答

这是我相关的数据库数据图片说明

这是我相关的数据库数据图片说明

values打错了,user关键字用[]括起

Insert Into User(Uname,Password,E-mail)Valuse

===》

Insert Into Uservalues

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问