Reputation: 4848
I start a new project. I then add a blank form and then add a ReportViewer control to the form. I then dock the control to the form.
Next, I add a new dataset (DataSet1.xsd) to the project. I then open server explorer and drag a specific view (not a table) to DataSet1's form. I can then see all the fields in the view on displayed on the dataset's form. If I choose to, I can preview the data and validate that the Fill, GetData() functions work (and they do. I can see all the data). I then go back to my main form (Form1) and choose to design a new report. I tell the report wizard what datasource to use and then I drag the needed fields to the Row grouping box and the Values box. I click next and choose the layout of my report and style.
Finally, I go back to Form1 and choose the the report that I want on that reportviewer control. I build and then run the project. The form is displayed, but no report appears in the viewer control. For the life of me, I cannot figure out why. Have I skipped a step somewhere? I could have sworn that this is what I did before to do a simple report but it doesn't appear to be working.
I even tried to step through with debug on the Fill method of the dataset's TableAdapter and that's seem to be where it's getting stuck. Yet, I can use that same table adapter fill routine to preview the data. I've made no changes to any code so I'm at a loss. Any ideas?
FILL code:
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'DataSet1.CAV_MBRHISTDETL' table. You can move, or remove it, as needed.
this.CAV_MBRHISTDETLTableAdapter.Fill(this.DataSet1.CAV_MBRHISTDETL);
this.reportViewer1.RefreshReport();
}
SQL to fill dataset:
SELECT
MBRSEP,
LOCATION,
BILLDATE,
READDATE,
DUEDATE,
READTYPE,
BILLTYPE,
CREDITCODE,
BILLMOYR,
METERREAD,
KWH
FROM CAR1.CAV_MBRHISTDETL
WHERE BILLTYPE = '09' AND
BILLMOYR <> '9999'
AND ROWNUM <= 100
Connection String:
connectionString="Dsn=UPN2;uid=car1;dbq=SEDC;dba=W;apa=T;exc=F;fen=T;qto=T;frc=10;fdl=10;lob=T;rst=T;btd=F;bnf=F;bam=IfAllSuccessful;num=NLS;dpm=F;mts=T;mdi=F;csr=F;fwc=F;fbs=64000;tlo=O;mld=0;oda=F"
Upvotes: 0
Views: 2286
Reputation: 4848
I think I've found my problem. In Visual Studio 2010, I clicked on 'Debug' then 'Exceptions' and checked every exception in the resulting window. Somehow, I thought, an error was happening and I wasn't being made aware of it.
Sure enough, when I ran my report program again I got an error message stating that my password was null. Imagine that! I had to put my user ID and password in when I previewed the data in the dataset.xsd screen, but not once did the program ask for my password when I ran it. I am also wondering why the program didn't just completely stop with an error instead of just sitting there. Anyway, when I supplied the password in my connection string, and re-ran, everything worked. Whew!
Upvotes: 1