error in odbc data provider
Hi..
I am working on desktop application with sql server 2000 database i am using ADODB for database connection.
but when i run project i am getting following error.
System.NullReferenceException was unhandled
Message: Object reference not set to an instance of an object.
code is bellow
this.combo1.Items.Clear();
this.combo1.Text = "Select";
if (!this.optinvoice.Checked)
return;
this.gbdate.Visible = false;
this.gbname.Visible = true;
this.gbname.Text = "By Invoice#";
this.adodc1.CommandType = CommandTypeEnum.adCmdText;
this.adodc1.RecordSource = "select serial from purchase_invoice";
this.adodc1.Refresh();
if (this.adodc1.Recordset.RecordCount <= 0)
return;
this.adodc1.Recordset.MoveFirst();
for (this.cnt = 1; this.cnt <= this.adodc1.Recordset.RecordCount; ++this.cnt)
{
this.combo1.Items.Add(this.adodc1.Recordset.get_Collect((object)0));
this.adodc1.Recordset.MoveNext();
}
while same code in framework 1.1 working nice..