| | |
Invalid Object error, yet Table already created.
Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Sep 2006
Posts: 88
Reputation:
Solved Threads: 0
I'm trying to use VB.NET to insert the data in the current row of my datagrid into a table. I wrote the following code:
The problem is that although there doesn't seem to be anything wrong with the code I get an unhandled SQLException on the sqlCom.ExecuteNonQuery() statement that says "Invalid object name 'OTM_ORDERS'."
I've already created this table using SQL, so why am I not able to insert data into it?
VB.NET Syntax (Toggle Plain Text)
Dim vCustomer, vBulkQty, vItem, vBaseUnit, vEachQty, vEachUnit As String vCustomer = dgCustomers.CurrentRow.Cells(0).Value vItem = dgItems.CurrentRow.Cells(0).Value vBulkQty = dgItems.CurrentRow.Cells(3).Value vBaseUnit = dgItems.CurrentRow.Cells(4).Value vEachQty = dgItems.CurrentRow.Cells(5).Value vEachUnit = dgItems.CurrentRow.Cells(6).Value Dim Insert As String Insert = "INSERT INTO OTM_ORDERS(CustomerID,ItemNo,BulkQty,BaseUnit,EachQty,StockUnit) " _ & "VALUES ('" & Trim(vCustomer) & "','" & Trim(vItem) & "','" & Trim(vBulkQty) & "','" _ & Trim(vBaseUnit) & "','" & Trim(vEachQty) & "','" & Trim(vEachUnit) & "')" Dim sqlCom As New SqlCommand(Insert, conn) sqlCom.ExecuteNonQuery()
The problem is that although there doesn't seem to be anything wrong with the code I get an unhandled SQLException on the sqlCom.ExecuteNonQuery() statement that says "Invalid object name 'OTM_ORDERS'."
I've already created this table using SQL, so why am I not able to insert data into it?
Last edited by bajanpoet; Feb 10th, 2009 at 4:01 pm. Reason: these damn code tags.... argh
![]() |
Similar Threads
- Updated : Simple ASP.Net Login Page (ASP.NET)
- Simple ASP.Net Login Page using C# (C#)
- explorer.exe using major memory and is misfunctioned (Viruses, Spyware and other Nasties)
- How in save data from a text box into table at vb 2005 (VB.NET)
- my log... scaned with dss.exe and hijackthis (Viruses, Spyware and other Nasties)
- Please check my code below (Java)
- memory management in wndows 2000 (Windows NT / 2000 / XP)
- modify script (Perl)
- HELP - Invalid object error related to sqlole null bug in MSSQL 2000 (MS SQL)
- Very New to java, skeleton of program given (Java)
Other Threads in the VB.NET Forum
- Previous Thread: Barcode basics
- Next Thread: VB Array values
| Thread Tools | Search this Thread |
"crystal .net .net2005 30minutes 2005 2008 access arithmetic array assignment basic binary bing box button buttons center check code combobox component connectionstring convert crystalreport data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dosconsolevb.net dropdownlist editvb.net excel file-dialog firewall folder ftp google hardcopy image images isnumericfuntioncall listview login math memory mobile ms mssqlbackend navigate net networking opacity output peertopeervideostreaming picturebox picturebox1 plugin port print problemwithinstallation project record reports" save savedialog searchbox serial soap sorting sql string tcp temp text textbox timer toolbox trim updown upload useraccounts usercontrol vb vb.net vb.netcode vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet view visual visualbasic visualbasic.net visualstudio web wpf





