4
Reply

Database update error

A

A

Nov 18 2008 8:04 AM
3.4k
I'm trying to write a questionnaire that gathers info of the user and then updates a database in Access. I've managed to write the program and everything works up to the point where it updates the database, at which point it displays the error message below:

OleDbException was unhandled
Syntax error in INSERT INTO statement

I've checked it and I can't find any syntax errors in it. Could someone help me out please? I'm very new to programming, so please try to explain in as simple terms as possible. The section of code is below. Thanks for your help.

if (Found == "F")
{
if (txtPasswordInput.Text == txtConfirmPassword.Text)
{
DataRow drNewRow = m_dtLoginTable.NewRow(); //creates variable
drNewRow["Username"] = txtUsernameInput.Text;
drNewRow["Password"] = txtPasswordInput.Text;
m_dtLoginTable.Rows.Add(drNewRow);
m_dtDataAdapter.Update(m_dtLoginTable); database
m_rowPosition = m_dtLoginTable.Rows.Count - 1;
new record
}
else
{
txtError.Text = "Passwords do not match";
}

}

Answers (4)