我在以下行Syntax error in INSERT INTO statement
command.ExecuteNonQuery();
顺便说一下,我已经发了一些相似的帖子,我试图解决我的问题,但我无法这样做。
我的数据库是MS Access
。
任何帮助都会很棒!
private void btn_register_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(txt_name.Text) || string.IsNullOrEmpty(txt_family.Text))
{
MessageBox.Show("Some information is missed");
}
else
{
this.Hide();
connection.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = connection;
command.CommandText = " insert into Login (FirstName,FamilyName,UserName,PassWord,RepeatPassword,Email,MaxTime,LearningStyle) values ('" + txt_name.Text + "','" + txt_family.Text + "','" + txt_username.Text + "','" + txt_password.Text + "','" + txt_repeat.Text + "','" + txt_mail.Text + "','" + UpDownTime.Value + "','" + UpDownLearningStyle.Value + "')";
command.ExecuteNonQuery();
MessageBox.Show("Your Registeration was successfull !");
connection.Close();
Login F1 = new Login();
F1.Show();
}
}
答案 0 :(得分:0)
试试这个。也许它可以帮助
密码是保留关键字
command.CommandText = " insert into Login (FirstName,FamilyName,UserName,PassWord,RepeatPassword,Email,....
试试这个
command.CommandText = " insert into Login (FirstName,FamilyName,UserName,[PassWord],RepeatPassword,Email,.....