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)";

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)";

All sorted now thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.