-2
當我嘗試運行並在我的數據庫中插入數據時出現語法錯誤....我有一個登錄按鈕和刪除按鈕,工作正常....但這一個不我不明白.....有人可以告訴我一個替代插入或錯誤是什麼?Acces數據庫應用程序中的斷點C#
public partial class Register : Form
{
private OleDbConnection connect = new OleDbConnection();
public Register()
{
InitializeComponent();
connect.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=resources\Users.accdb;
Persist Security Info=False;";
}
private void register1_Click(object sender, EventArgs e)
{
try
{
connect.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = connect;
command.CommandText ="insert into Users(Username, Password, Email) values(' " + userR_box.Text + " ',' " + passwordR_box.Text + " ',' " + mailR_box.Text + " ')";
if ((userR_box.Text == "") || (passwordR_box.Text == "") || (mailR_box.Text == ""))
{
MessageBox.Show("Va rugam completati toate campurile");
}
else
{
command.ExecuteNonQuery();
}
}
catch (Exception ex)
{
MessageBox.Show("Error "+ ex);
}
connect.Close();
}
你能添加錯誤跟蹤嗎? –