G
Guest
This is for a Win form.
The code below causes combo box to have
"System.Data.DataViewManagerListItemTypeDescriptor" in the drop down box.
What I'm I missing in my code to get the data out of the SP into the combo
box?
string sProc = "prGet_LicenseCode";
using (SqlConnection oCn = new
SqlConnection(sConnString))
{
using (SqlCommand oCmd = new
SqlCommand(sProc, oCn))
{
oCn.Open();
oCmd.CommandType =
CommandType.StoredProcedure;
oCmd.Parameters.Add("@sLicenseYear",
SqlDbType.NChar, 6);
oCmd.Parameters["@sLicenseYear"].Value = txtLicYear.Text;
SqlDataAdapter oDa = new
SqlDataAdapter();
oDa.SelectCommand = oCmd;
DataSet ds=new DataSet();
oDa.Fill(ds);
int numTables = ds.Tables.Count;
//No table no records.
if (numTables < 1)
{
MessageBox.Show("No License
Codes found for that year.", "No record found", MessageBoxButtons.OK);
}
else
{
cboPrivilege.DataSource = ds;
}
}
}
The code below causes combo box to have
"System.Data.DataViewManagerListItemTypeDescriptor" in the drop down box.
What I'm I missing in my code to get the data out of the SP into the combo
box?
string sProc = "prGet_LicenseCode";
using (SqlConnection oCn = new
SqlConnection(sConnString))
{
using (SqlCommand oCmd = new
SqlCommand(sProc, oCn))
{
oCn.Open();
oCmd.CommandType =
CommandType.StoredProcedure;
oCmd.Parameters.Add("@sLicenseYear",
SqlDbType.NChar, 6);
oCmd.Parameters["@sLicenseYear"].Value = txtLicYear.Text;
SqlDataAdapter oDa = new
SqlDataAdapter();
oDa.SelectCommand = oCmd;
DataSet ds=new DataSet();
oDa.Fill(ds);
int numTables = ds.Tables.Count;
//No table no records.
if (numTables < 1)
{
MessageBox.Show("No License
Codes found for that year.", "No record found", MessageBoxButtons.OK);
}
else
{
cboPrivilege.DataSource = ds;
}
}
}