| | |
Invalid Object error, yet Table already created.
Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Sep 2006
Posts: 90
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
Views: 702 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2008 access add advanced application array assignment basic beginner box browser button buttons center click client code combo convert cpu cuesent data database datagrid datagridview datetimepicker designer dissertation dissertations dissertationtopic eclipse editvb.net employees excel exists forms function html images isnumericfuntioncall lib listview map mobile module msaccess mssqlbackend mysql net number open page pan pdf picturebox picturebox2 port print printing printpreview problem record regex reuse richtextbox right-to-left save search serial settings socket sorting sqldatbase sqlserver storedprocedure structures temp textbox timer transparency txttoxmlconverter usercontol vb vb.net vb2008 vba vbnet vista visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web winsock wpf wrapingcode xml





