rivate Sub TESTLoadStoredProcedure() '(ByVal strLine As String, ByVal strSection As String, ByVal strSite As String)
Dim ds As New DataSet
Dim da As New SqlDataAdapter
Dim comm As New SqlCommand
Dim dsrv As New imsDataServices
' Dim output As Integer
Dim paramResult As New SqlParameter
Try
With comm
.Connection = dsrv.Connection
.CommandType = CommandType.StoredProcedure
' .CommandText = "sp_MAC_imsSP_StockValueByItemAsOfTransDate"
.CommandText = " sp_MAC_TESTLoadDataListbox"
'.Parameters.AddWithValue("@AsOfDate", dtAsOfDate.Value)--
' .Parameters.AddWithValue("@ItemTypeCode", cboItemType.Text)
'.Parameters.AddWithValue("@ItemID", cboItemID.Text)
'.Parameters.AddWithValue("@ProdFam", cboProFam.Text)--
' .Parameters.AddWithValue("@Classification", cboCate.Text)
' .Parameters.AddWithValue("@LeadTimeCode", cboPurchase.Text)
' .Parameters.AddWithValue("@ItemStatusCode", cboStatus.Text)
'.Parameters.AddWithValue("@ItemStatusCode", cboLocationID.Text)
.Parameters.AddWithValue("@ItemStatusCode", chkLocation.Text)
End With
'max = comm.ExecuteScalar()
da.SelectCommand = comm
da.Fill(ds, "Show")
grdTEST.DataSource = ds.Tables("Show")
'grdCost.RowsDefaultCellStyle.BackColor = Drawing.Color.White
'grdCost.AlternatingRowsDefaultCellStyle.BackColor = Drawing.Color.PowderBlue
Catch exsql As SqlException
MsgBox(exsql.Message, MsgBoxStyle.Exclamation)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Exclamation)
End Try
End Sub
Private Sub TESTLoadStoredProcedure() '(ByVal strLine As String, ByVal strSection As String, ByVal strSite As String)
Dim ds As New DataSet
Dim da As New SqlDataAdapter
Dim comm As New SqlCommand
Dim dsrv As New imsDataServices
' Dim output As Integer
Dim paramResult As New SqlParameter
Dim a As String
Dim b As String
Dim c As String
Dim tempLocation As String
Try
With comm
.Connection = dsrv.Connection
.CommandType = CommandType.StoredProcedure
' .CommandText = "sp_MAC_imsSP_StockValueByItemAsOfTransDate"
.CommandText = "sp_MAC_TESTLoadDataListbox"
'.Parameters.AddWithValue("@AsOfDate", dtAsOfDate.Value)--
' .Parameters.AddWithValue("@ItemTypeCode", cboItemType.Text)
'.Parameters.AddWithValue("@ItemID", cboItemID.Text)
'.Parameters.AddWithValue("@ProdFam", cboProFam.Text)--
' .Parameters.AddWithValue("@Classification", cboCate.Text)
' .Parameters.AddWithValue("@LeadTimeCode", cboPurchase.Text)
' .Parameters.AddWithValue("@ItemStatusCode", cboStatus.Text)
'.Parameters.AddWithValue("@ItemStatusCode", cboLocationID.Text)
Dim i As Integer
'chkLocation.SetItemChecked(i, True)
If chkLocation.CheckedItems.Count = 0 Then
Exit Sub
Else
tempLocation = chkLocation.SelectedItem(0).ToString
End If
' For i = 0 To chkLocation.Items.Count - 1
'chkLocation.Text = i + 1
' Next
' For Each itm As String In chkLocation.CheckedItems
'If tempLocation.ToString = -1 Then
'tempLocation.Insert(0, itm)
' End If
' Next
.Parameters.AddWithValue("@LocationID", tempLocation)
End With
'max = comm.ExecuteScalar()
da.SelectCommand = comm
da.Fill(ds, "Show")
grdTEST.DataSource = ds.Tables("Show")
'grdCost.RowsDefaultCellStyle.BackColor = Drawing.Color.White
'grdCost.AlternatingRowsDefaultCellStyle.BackColor = Drawing.Color.PowderBlue
Catch exsql As SqlException
MsgBox(exsql.Message, MsgBoxStyle.Exclamation)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Exclamation)
End Try
End Sub
Dim comm As New SqlCommand
With comm
If CheckedListBox1.CheckedItems.Count = 0 Then
' ไม่เลือกเลย
Exit Sub
End If
Dim objArrList = New ArrayList(CheckedListBox1.CheckedItems.Count)
For Each chItem In CheckedListBox1.CheckedItems
objArrList.Add(chItem)
Next
If CheckedListBox1.CheckedItems.Count = 1 Then
' เลือก 1 ช่อง
.Parameters.AddWithValue("@LocationID", objArrList(0))
End If
If CheckedListBox1.CheckedItems.Count = 2 Then
' เลือก 2 ช่อง
.Parameters.AddWithValue("@LocationID", objArrList(0))
.Parameters.AddWithValue("@LocationID1", objArrList(1))
End If
If CheckedListBox1.CheckedItems.Count = 3 Then
' เลือก 3 ช่อง
.Parameters.AddWithValue("@LocationID", objArrList(0))
.Parameters.AddWithValue("@LocationID1", objArrList(1))
.Parameters.AddWithValue("@LocationID2", objArrList(2))
End If
If CheckedListBox1.CheckedItems.Count = 4 Then
' เลือก 4 ช่อง
.Parameters.AddWithValue("@LocationID", objArrList(0))
.Parameters.AddWithValue("@LocationID1", objArrList(1))
.Parameters.AddWithValue("@LocationID2", objArrList(2))
.Parameters.AddWithValue("@LocationID3", objArrList(3))
End If
If CheckedListBox1.CheckedItems.Count = 5 Then
' เลือก 5 ช่อง
.Parameters.AddWithValue("@LocationID", objArrList(0))
.Parameters.AddWithValue("@LocationID1", objArrList(1))
.Parameters.AddWithValue("@LocationID2", objArrList(2))
.Parameters.AddWithValue("@LocationID3", objArrList(3))
.Parameters.AddWithValue("@LocationID4", objArrList(4))
End If
End With