D
Dan Keeley
Hi,
I've got another problem now! Getting "Input string was not in a correct
format"
I have this as my insert command:
myDataAdapter.InsertCommand = connection.CreateCommand()
myDataAdapter.InsertCommand.CommandText = _
"Insert into Suppliers " & _
"(SupplierName, TechnicalContact, SalesContact, OperationsContact,
WorkPhone, FaxNumber" & _
" , Address, City, County, PostalCode, Email, MobilePhone) " & _
"values(&SupplierName, &TechnicalContact, &SalesContact, &OperationsContact,
&WorkPhone, &FaxNumber" & _
", &Address, &City, &County, &PostalCode, &Email, &MobilePhone )"
AddParms(myDataAdapter.InsertCommand, "SupplierName", "TechnicalContact",
"SalesContact", "OperationsContact" _
, "WorkPhone", "FaxNumber", "Address", "City", "County", "PostalCode",
"Email", "MobilePhone")
MsgBox(myDataAdapter.InsertCommand.CommandText)
Followed by:
Dim newRow As DataRow = myDataTable.NewRow()
newRow("SupplierName") = txtSupplierName.Text
newRow("TechnicalContact") = txtTechnicalContact.Text
newRow("SalesContact") = txtSalesContact.Text
newRow("OperationsContact") = txtOperationsContact.Text
newRow("WorkPhone") = txtPhone.Text
newRow("FaxNumber") = txtFax.Text
newRow("Address") = txtAddress.Text
newRow("City") = txtCity.Text
newRow("County") = txtCounty.Text
newRow("PostalCode") = txtPostalCode.Text
newRow("Email") = "BLAR"
newRow("MobilePhone") = txtPhone.Text
Then when i do this:
myDataTable.Rows.Add(newRow)
MsgBox(newRow.ItemArray.Length)
'Update the DB
Try
myDataAdapter.Update(myDataSet, "Suppliers")
I get the error.
Now I can't for the life of me find the problem. I'm not inserting anything
into my key field, but thats autonumber, so this shouldnt matter right?
How can i find the ACTUAL sql that it's having a problem with, I can't seem
to get to it in the debugger.
I've confirmed that the datatable and newrow have the same number of items,
which makes sense...
Any hints on either a fix, or just simply debugging this would be a massive
help! Thanks once again!
Rgds,
Dan
I've got another problem now! Getting "Input string was not in a correct
format"
I have this as my insert command:
myDataAdapter.InsertCommand = connection.CreateCommand()
myDataAdapter.InsertCommand.CommandText = _
"Insert into Suppliers " & _
"(SupplierName, TechnicalContact, SalesContact, OperationsContact,
WorkPhone, FaxNumber" & _
" , Address, City, County, PostalCode, Email, MobilePhone) " & _
"values(&SupplierName, &TechnicalContact, &SalesContact, &OperationsContact,
&WorkPhone, &FaxNumber" & _
", &Address, &City, &County, &PostalCode, &Email, &MobilePhone )"
AddParms(myDataAdapter.InsertCommand, "SupplierName", "TechnicalContact",
"SalesContact", "OperationsContact" _
, "WorkPhone", "FaxNumber", "Address", "City", "County", "PostalCode",
"Email", "MobilePhone")
MsgBox(myDataAdapter.InsertCommand.CommandText)
Followed by:
Dim newRow As DataRow = myDataTable.NewRow()
newRow("SupplierName") = txtSupplierName.Text
newRow("TechnicalContact") = txtTechnicalContact.Text
newRow("SalesContact") = txtSalesContact.Text
newRow("OperationsContact") = txtOperationsContact.Text
newRow("WorkPhone") = txtPhone.Text
newRow("FaxNumber") = txtFax.Text
newRow("Address") = txtAddress.Text
newRow("City") = txtCity.Text
newRow("County") = txtCounty.Text
newRow("PostalCode") = txtPostalCode.Text
newRow("Email") = "BLAR"
newRow("MobilePhone") = txtPhone.Text
Then when i do this:
myDataTable.Rows.Add(newRow)
MsgBox(newRow.ItemArray.Length)
'Update the DB
Try
myDataAdapter.Update(myDataSet, "Suppliers")
I get the error.
Now I can't for the life of me find the problem. I'm not inserting anything
into my key field, but thats autonumber, so this shouldnt matter right?
How can i find the ACTUAL sql that it's having a problem with, I can't seem
to get to it in the debugger.
I've confirmed that the datatable and newrow have the same number of items,
which makes sense...
Any hints on either a fix, or just simply debugging this would be a massive
help! Thanks once again!
Rgds,
Dan