| | |
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
- Simple ASP.Net Login Page using C# (C#)
- Updated : Simple ASP.Net Login Page (ASP.NET)
- 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 |
.net .net2008 30minutes 2005 2008 access account arithmetic array basic binary bing button buttons center check code combobox component connectionstring crystalreport data database databasesearch datagrid datagridview date design dissertation dissertations dropdownlist excel fade file-dialog filter folder ftp generatetags google hardcopy images input insert intel internet mobile monitor ms net networking objects output panel passingparameters peertopeervideostreaming picturebox picturebox1 port position print printing problem problemwithinstallation project save searchbox searchvb.net select serial shutdown soap survey table tcp temperature text textbox timer timespan toolbox trim update updown user vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf year





