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 + "')";
他总是说我添加语句错误,可是我都是改了好几遍都还是这个错误。