| | |
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 |
.net .net2008 2008 access advanced application array basic beginner browser button buttons center click client code combo convert cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic eclipse excel exists fade filter forms function generatetags gridview html images input internet listview map mobile module monitor msaccess net number objects open panel pdf picturebox picturebox2 port position print printing problem read regex remove right-to-left save search searchvb.net select serial settings shutdown socket sqldatbase sqlserver survey temperature textbox timer timespan transparency txttoxmlconverter user usercontol vb vb.net vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web winforms winsock wpf wrapingcode xml year





