'----------------------------------- CONFIGURATION -------------------------------------
Dim server As String = "TEST"
Dim database As String = "TEST"
Dim user As String = "test"
Dim password As String = "test"
Dim myItem As String = _ITEMNMBR
Dim mySite As String = _SITEID
Dim myQty as double = 0
'Dim myQtyString as string = ""
'---------------------------------------------------------------------------------------
'Declare the connection string based on the configuration variables
Dim conString As New String("Data Source=" & server & ";Initial Catalog=" & database & ";User=" & user & ";Password=" & password & ";")
'Define the query command to be run
Dim execute As String = "select qtyonhnd-atyalloc as qtyavlbl from iv00102 where itemnmbr = '" & myItem & "' and locncode = '" & mySite & "'"
'Microsoft.VisualBasic.MsgBox(execute)
'Define the SQL connection and open it
Dim myConn As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(conString)
myConn.Open()
'Declare the SQL command as the query string
Dim myCmd As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand(execute, myConn)
'Define the SQL Reader and execute it
Dim sqlReader As System.Data.SqlClient.SqlDataReader = myCmd.ExecuteReader()
sqlReader.Read()
myQty = Decimal.Parse(sqlReader("qtyavlbl"))
'myQtyString = sqlReader("qtyavlbl").ToString
IF _QUANTITY < myQty THEN
myQty = _QUANTITY
END IF
'Microsoft.VisualBasic.MsgBox(myQty)
'Microsoft.VisualBasic.MsgBox(myQtyString)
Return myQty
No comments:
Post a Comment