Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error printing report from .net

Status
Not open for further replies.

wawalter

Programmer
Aug 2, 2001
125
US
I have a really simple report I am trying to print from .Net 2002 using a Dataset as the data source, like I have 10 other times, but I keep getting the following error:


A first chance exception of type 'System.NullReferenceException' occurred in crdb_adoplus.dll

Additional information: Object reference not set to an instance of an object.


I have tried deleting the report and dataset and recreating them. I have reduced my dataset down to one field and changed which field that is and I have rebooted my machine a couple times.

It errors on the PrintToPrinter call.

Code:
ReportClass crSchedule = new rptSampleSchedule();

// Get the counts
string sql = "usp_prdRptSampleSchedule";
SqlDataAdapter da = new SqlDataAdapter(sql, Utility.ConnectionMain(m_Config.AppRunEnvironment));
DataSet ds = new DataSet("SampleSchedule");
da.Fill(ds);
		
crSchedule.SetDataSource(ds);

// print it
crSchedule.PrintToPrinter(1,false,0,0);

Here is the stored proc I am using which returns one number when run from query analyzer and shows one record in the dataset when I debug it:

Code:
select TOP 1 s_shipqty from prd_PCsamples

If I swap out the dataset for one that I know works it works OK, so the problem must be with the dataset, but it is so simple I just don't see where.

Thanks for any help you can offer.
 
Is the error coming up before this code exists or after?
If after, you may have a local variable going out of scope. Just a guess, since I don't use .Net

hth,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
The error occurs at the PrintToPrinter method call during runtime.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top