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

Recommended Answers

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

Jump to Post

All 4 Replies

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 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.