我在访问连接时出现问题然后发生错误无法找到文件'C:\ Users \ Geeta \ Desktop \ test1.mdb'。和mycode是:
protected void btn_submit_Click(object sender, EventArgs e)
{
System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();
// TODO: Modify the connection string and include any
// additional required properties for your database.
conn.ConnectionString = (@"Provider=Microsoft.Jet.OLEDB.4.0;Data source= C:\Users\Geeta\Desktop\test1.mdb");
conn.Open();
string query = "insert into test (First Name,Address,Email,Password) values ('" + txt_fstname.Text + "','" + txt_email.Text + "', '"+txt_pass.Text+"', '"+txt_add.Text+"')";
OleDbCommand cmd = new OleDbCommand(query,conn);
cmd.ExecuteNonQuery();
conn.Close();
Response.Redirect("Default.aspx");
}
请帮助我。
“谢谢”
答案 0 :(得分:0)
尝试使用以下连接字符串:
conn.ConnectionString = (@"Provider=Microsoft.Jet.OLEDB.4.0;Data source=C:\Users\Geeta\Desktop\test1.mdb;");
注:
此外: