Hi,
I'm trying to bind the data to a drop down list, here is the code:
Private Sub BindVendors()
With New GlobalSystems
dsGlobal = New GlobalData
storeID = CInt(Session("STOREID"))
If storeID <> 0 Then
dsGlobal = .GetVendorLotto(storeID)
If Not dsGlobal Is Nothing Then
Session.Add("dsVendorsList", dsGlobal)
ddlVendor.DataSource = dsGlobal.Tables(Vendor_Data.TBL_VENDORPROFILE)
ddlVendor.DataTextField = Vendor_Data.COMPANYNAME
ddlVendor.DataValueField = Vendor_Data.VENDORID
ddlVendor.DataBind()
ddlVendor.Items.Insert(0, New ListItem("-Select Any-", "-1"))
End If
End If
End With
End Sub
Function to get the vendor details
Public Function GetVendorLotto(ByVal StoreID As Int32) As GlobalData
With New GlobalAccess
GetVendorLotto = .GetVendorLotto(StoreID)
End With
End Function
In the below code the result is showing 0. But the data is there in the table.
Public Function GetVendorLotto(ByVal storeID As Int32) As GlobalData
dsGlobal = New GlobalData
With sqlaAccounts
.SelectCommand = GetSelectCommand("usp_GetVendorAgainstStoreNLottery", 3)
.SelectCommand.Parameters("@storeID").Value = storeID
result = .Fill(dsGlobal, Vendor_Data.TBL_VENDORPROFILE
End With
If result > 0 Then
If dsGlobal Is Nothing Then
Else
GetVendorLotto = dsGlobal
End If
End If
End Function
Private Function GetSelectCommand(ByVal storedProcName As String, ByVal whichCommand As Int16) As SqlCommand
sqldCommand = New SqlCommand(storedProcName, New SqlConnection(CStoresConfiguration.ConnectionString))
sqldCommand.CommandType = CommandType.StoredProcedure
If whichCommand = 3 Then
With sqldCommand.Parameters
.Add(New SqlParameter("@storeID", SqlDbType.Int))
End With
End If
GetSelectCommand = sqldCommand
End Function
There is data in the database, but the data is not binding.
Can someone help me please?