Hi I have been trying to get the data display on the datagrid after selecting a customer.
With the same connection it populates the selection right. But just do not seem to extract the following SQL.
The litABC is to check the flow of control.
There is no syntax error but in the debug menu,
I got A first chance exception of type 'System.Data.Od bc.OdbcExceptio n' occurred in System.
Where did I do wrong?
With the same connection it populates the selection right. But just do not seem to extract the following SQL.
The litABC is to check the flow of control.
There is no syntax error but in the debug menu,
I got A first chance exception of type 'System.Data.Od bc.OdbcExceptio n' occurred in System.
Where did I do wrong?
Code:
public void DoReport()
{
try
{
string sSQL = "";
string sTitle = "";
string sGrouping = "";
// if the start date and end date are not set show the alert.
if (!(dcalStart.IsSet && dcalEnd.IsSet))
{
CommonFunctions.ShowAlert(this, "You must select Start and End dates for the report. ");
return;
}
string sBillTo = lstCustomer.SelectedValue;
string sStart = dcalStart.Text;
string sEnd = dcalEnd.Text;
litABC.Text = "0";
if (!string.IsNullOrEmpty(sBillTo))
{
sSQL = "SELECT deb_master FROM deb_import";
sTitle = "Customer Group '" + sBillTo.Trim() + "'";
sGrouping = "Branch";
litABC.Text = "1";
}
else
{
sTitle = "Second Line '" + sBillTo.Trim() + "'";
sGrouping = "Where is the data????";
litABC.Text = "2";
}
DataTable res = DataFunctions.SQLToDataTable(sSQL);
Results.Columns[0].HeaderText = sGrouping;
Results.DataSource = Results;
Results.DataBind();
litTitle.Text = sSQL;
litDateRange.Text = sStart + " - " + sEnd;
Results.Visible = true;
tblOutput.Visible = true;
}
catch (Exception ex)
{
Literal l = new Literal();
l.Text = "<p style=\"font-weight: bold; color: red;\">" + ex.Message + "</p>";
phError.Controls.Add(l);
}
}
Comment