I've been working for several hours trying to correctly write to a database file. Here are the parameters:
Database Name: DATADESIGNSOLUTIONS
Table Name: PRINTERMAINT
Column Names: PrinterID (primary Key), PrinterName, PrinterNumber, PrinterLocation, PrinterAddress
I've been working at this two ways: through the Visual Basic code and through SQL Server Management. I'm getting the same errors in both places. The error reads:
Invalid column name 'printName'.
Invalid column name 'printNo'.
Invalid column name 'printLoc'.
Invalid column name 'printAdd'.
Here's the code I've written"
Try con.ConnectionString = "Data Source=DON-PC;Initial Catalog=DATADESIGNSOLUTIONS;Integrated Security = True;User ID=DON-PC;Password=be67011;" con.Open() cmd.Connection = con cmd.CommandText = "INSERT INTO PRINTERMAINT(PrinterName, PrinterNumber, PrinterLocation, PrinterAddress) " & _ "VALUES (printName, printNo, printLoc, printAdd)" cmd.ExecuteNonQuery() Catch ex As Exception MessageBox.Show("Error while inserting record on table..." & ex.Message, "Insert Records") Finally con.Close() End Try
By the way,
INSERT INTO PRINTERMAINT(PrinterName, PrinterNumber, PrinterLocation, PrinterAddress)
doesn't work in SQL Server Management either. It keeps telling me these are invalid column names.
Can someone point out to me what I'm doing wrong?
In advance, thanks for the help.