|
-
Oct 19th, 2011, 12:20 PM
#5
Thread Starter
Member
Re: Falling through to Error - HELP
Ok. I figured out why it was falling through . The data for the one field I was trying to get is NULL. I now have to build that data then update it. Now that I have that data built out. It is throwing out a weird error referring to column name invalid referring to actual data instead of a column name. I'm sorry to have so many questions. I'm primarily a DBA with SQL and I have done a lot of VB in the past; however, I'm fairly new to VB .net and I appreciate any assistance I can get expanding my horizons.
The following code is where it is erroring out on.
Public Sub Insert_Case_UPC_OITM(ByVal UPC_Code As String)
Dim Item_Case As String = String.Concat(TextBox1.Text, "-")
Item_Case = String.Concat(Item_Case, TextBox2.Text)
' Update OITM Table with New UPC Code for the CodeBars field
Dim adapter As New SqlDataAdapter
Dim sql As String = "UPDATE OITM SET CodeBars = " & UPC_Code & " WHERE OITM.ItemCode = " & Item_Case
MsgBox(sql)
Try
If ConnectionState.Closed Then
Connection.Open()
End If
adapter.UpdateCommand = New SqlCommand(sql, Connection)
adapter.UpdateCommand.ExecuteNonQuery()
MessageBox.Show("Case UPC for Item has been updated !", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information)
If ConnectionState.Open Then
Connection.Close()
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
The sql appears to be displaying correctly so I suspect it has something to do with the adapter commands in which it is trying to execute the code.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|