I am trying to execute an INSERT statement on an Access database, but I'm gettting the error that the number of query values and destination fields are not the same. The query is rather lengthy, but here is where I believe the problem to be...
txtCity.Text + "', " + ddState.DataValueField + ", " + txtZip.Text
Since the value I'm extracting is an integer, I'm leaving it without quotes. Does anyone know what I'm doing wrong here? (The entire query is listed below)
OleDbCommand myCommand = new OleDbCommand(("INSERT INTO contacts (firstName, lastName, street1, street2, city, stateID, workPhone, homePhone, email) VALUES ('" + txtFirstName.Text + "', '" + txtLastName.Text + "', '" + txtStreet1.Text + "', '" + txtStreet2 + "', '" + txtCity.Text + "', " + ddState.DataValueField + ", '" + txtZip.Text + ", " + txtWorkPhone.Text + ", " + txtHomePhone.Text + ", '" + txtEmail.Text + "'", objConnection);
txtCity.Text + "', " + ddState.DataValueField + ", " + txtZip.Text
Since the value I'm extracting is an integer, I'm leaving it without quotes. Does anyone know what I'm doing wrong here? (The entire query is listed below)
OleDbCommand myCommand = new OleDbCommand(("INSERT INTO contacts (firstName, lastName, street1, street2, city, stateID, workPhone, homePhone, email) VALUES ('" + txtFirstName.Text + "', '" + txtLastName.Text + "', '" + txtStreet1.Text + "', '" + txtStreet2 + "', '" + txtCity.Text + "', " + ddState.DataValueField + ", '" + txtZip.Text + ", " + txtWorkPhone.Text + ", " + txtHomePhone.Text + ", '" + txtEmail.Text + "'", objConnection);