|
-
Oct 19th, 2011, 11:02 AM
#1
Thread Starter
Member
Falling through to Error - HELP
Ok. I have querried this in Server Management Studio and The Record is there. I have the Item Code put together correctly prior to executing my query in VB; however, it keeps falling through to my error exception. Can anyone tell me what I'm doing wrong?
Public Sub Does_Case_UPC_Exists()
Dim Item_Case As String = String.Concat(TextBox1.Text, "-")
Item_Case = String.Concat(Item_Case, TextBox2.Text)
MsgBox(Item_Case)
Using cn As New SqlConnection(ConnectionString)
Using cmd As SqlCommand = cn.CreateCommand
cmd.CommandText = "SELECT OITM.CodeBars As U_upc_Code FROM OITM WHERE ItemCode = " & String.Format(Item_Case)
Try
cn.Open()
Dim o As Object = cmd.ExecuteScalar
If o IsNot Nothing Then
Me.TxtCaseUPC.Text = o.ToString
End If
cn.Close()
Catch ex As Exception
MsgBox("Item Does NOT exists in OITM table !")
Application.Exit()
End Try
End Using
End Using
End Sub
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
|