I am working on a program that updates a Database via ASP.NET (C#) using Microsoft Access and OleDb and have the following problem when loading my web form in FireFox:

"The INSERT INTO statement contains the following unknown field name: 'txtCustomerID'. Make sure you have typed the name correctly, and try the operation again."

I dont understand why i am getting this as i have labled 'txtCustomerID' textbox correctly in the webform, has it got to match exacly what the collumn is in the access database? Could it be that my query is not correct?

command.CommandText = command.CommandText = "INSERT INTO Customers (txtCustomerID, txtCompanyName, txtContactTitle, txtAddress, txtCity, txtRegion, txtPostalCode, txtCountry, txtPhone, txtFax) VALUES (@CustomerID, @CompanyName, @ContactTitle, @Address, @City, @Region, @PostalCode, @Country, @Phone, @Fax)";

4 Years
Discussion Span
Last Post by ROSS679

What it is telling you is there isn't a txtCustomerID field in the database. Are you sure you spelled it right?


I have made some slight changes and I am now getting this

Syntax error (missing operator) in query expression '@Customer ID'.

This is after i relised i missed a space between Customer and ID.


Think its been sorted now i am getting a basic error

*Syntax error in INSERT INTO statement. *

Complete Query

command.CommandText = command.CommandText = "INSERT INTO Customers (Customer ID, CompanyName, ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax) VALUES (@CustomerID, @CompanyName, @ContactTitle, @Address, @City, @Region, @Postal Code, @Country, @Phone, @Fax)";

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.