I am having trouble binding a dataset table to a datagrid control. Here's the code that yields no rows in the grid. I'm sure that the dataset table contains data.
'---------------------------------------------
strSQL = "SELECT tblBudget.lID, tblBudget.iMonth, tblBudget.lPounds, " _
& "tblBudget.cProcessing, tblBudget.cReplacement, tblBudget.lPWU, " _
& "tblBudget.lSWU, tblBudget.lTWU FROM tblBudget " _
& " WHERE tblBudget.iYear = " & ddlYear.SelectedItem.Value _
& " And tblBudget.iFacilityNumber = " & ddlFacility.SelectedItem.Value _
& " And tblBudget.iLocationNumber = " & ddlLocation.SelectedItem.Value _
& " ORDER BY tblBudget.iMonth;"
Dim conLaundry As New OleDbConnection(Application("sLCSConnectionString"))
Dim cmdlaundry As New OleDbCommand(strSQL, conLaundry)
Dim daLaundry As New OleDbDataAdapter(cmdlaundry)
Dim dsLaundry As New DataSet
Dim dgBudget As New DataGrid
daLaundry.Fill(dsLaundry, "Budget")
dgBudget.DataSource = dsLaundry.Tables("Budget")
dgBudget.DataBind()
'-------------------------------
Any ideas?
'---------------------------------------------
strSQL = "SELECT tblBudget.lID, tblBudget.iMonth, tblBudget.lPounds, " _
& "tblBudget.cProcessing, tblBudget.cReplacement, tblBudget.lPWU, " _
& "tblBudget.lSWU, tblBudget.lTWU FROM tblBudget " _
& " WHERE tblBudget.iYear = " & ddlYear.SelectedItem.Value _
& " And tblBudget.iFacilityNumber = " & ddlFacility.SelectedItem.Value _
& " And tblBudget.iLocationNumber = " & ddlLocation.SelectedItem.Value _
& " ORDER BY tblBudget.iMonth;"
Dim conLaundry As New OleDbConnection(Application("sLCSConnectionString"))
Dim cmdlaundry As New OleDbCommand(strSQL, conLaundry)
Dim daLaundry As New OleDbDataAdapter(cmdlaundry)
Dim dsLaundry As New DataSet
Dim dgBudget As New DataGrid
daLaundry.Fill(dsLaundry, "Budget")
dgBudget.DataSource = dsLaundry.Tables("Budget")
dgBudget.DataBind()
'-------------------------------
Any ideas?