麻烦大家帮我看看这段数据库连接有何问题?为何连接不上,数据插入不了
protected void Buttonadd_Click(object sender, EventArgs e)
{
string usname = TextBox1.Text;
string paword = TextBox2.Text;
OleDbConnection thisConnection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\henet\db1.mdb");
thisConnection.Open();
OleDbCommand thisCommand = thisConnection.CreateCommand();
thisCommand.CommandText = "INSERT INTO users1 VALUES ('" + usname + "','" + paword + "')";
thisConnection.Close();
}
protected void Buttonadd_Click(object sender, EventArgs e)
{
string usname = TextBox1.Text;
string paword = TextBox2.Text;
OleDbConnection thisConnection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\henet\db1.mdb");
thisConnection.Open();
OleDbCommand thisCommand = thisConnection.CreateCommand();
thisCommand.CommandText = "INSERT INTO users1 VALUES ('" + usname + "','" + paword + "')";
thisConnection.Close();
}
你到这个网站上,比照你自己的Access版本,查找对应的连接串说明和示例,这样会相对简单一点。
http://connectionstrings.com/