|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Crystal Reports in VB.NETI am able to create a Crystal report and get it to go to the screen., print,
Excel, etc. What I want to do now is allow for my VB.NET (2003) program to dynamically build a "WHERE clause" For example; I have 4000 records in an Access DB and I'm displaying Name, Address, State, ZIP. At this time all 4000 records are being displayed. I want to the user to print all customers in "IL". How can I build this request in the VB.NET program and than call the form where the Crystal report is located and display only records for "IL". Thanks in advance, Steve Hi Stephan
There are 2 ways of doing this, You can create a datatable or dataset with your where clause and pass it to your report like this: //dbmodtimeSheet, is a database class you would use ExecuteScaler etc like you would normally do to get the datatable. dim dt as new datatable dim report as As New TimeSheetReporta dt = dbmodtimeSheet.GetDataTable("SELECT * FROM History WHERE Name = 'ARITCHIE'") report.SetDataSource(dt) reportviewer.RunReport(report) Or you could, use the report filter to do it, which is the way I prefer. //NewTimeSheetReporta is the name of your report. dim report as As New TimeSheetReporta //LogonInfo is set up to prevent it asking you for the login all the time. LogonInfo.ConnectionInfo.UserID = user LogonInfo.ConnectionInfo.Password = pw report.Database.Tables(0).ApplyLogOnInfo(LogonInfo) report.Database.Tables(1).ApplyLogOnInfo(LogonInfo) report.RecordSelectionFormula = "{History.Weekno} = " & NumWeekno.Text reportviewer.RunReport(report) Stephen Plotnick wrote: Show quoteHide quote > I am able to create a Crystal report and get it to go to the screen., print, > Excel, etc. > > What I want to do now is allow for my VB.NET (2003) program to dynamically > build a "WHERE clause" > > For example; > > I have 4000 records in an Access DB and I'm displaying Name, Address, State, > ZIP. At this time all 4000 records are being displayed. I want to the user > to print all customers in "IL". How can I build this request in the VB.NET > program and than call the form where the Crystal report is located and > display only records for "IL". > > Thanks in advance, > Steve Thanks,
It seems the reportviewer is for VB 2005. Is there an equivalent for vb.net (2003)? Steve Show quoteHide quote "Alex" <aritc***@dashcomputer.co.uk> wrote in message news:1157532311.935093.219560@h48g2000cwc.googlegroups.com... > Hi Stephan > > There are 2 ways of doing this, You can create a datatable or dataset > with your where clause and pass it to your report like this: > > //dbmodtimeSheet, is a database class you would use ExecuteScaler etc > like you would normally do to get the datatable. > > dim dt as new datatable > dim report as As New TimeSheetReporta > dt = dbmodtimeSheet.GetDataTable("SELECT * FROM History WHERE Name = > 'ARITCHIE'") > report.SetDataSource(dt) > reportviewer.RunReport(report) > > Or you could, use the report filter to do it, which is the way I > prefer. > > //NewTimeSheetReporta is the name of your report. > dim report as As New TimeSheetReporta > //LogonInfo is set up to prevent it asking you for the login all the > time. > LogonInfo.ConnectionInfo.UserID = user > LogonInfo.ConnectionInfo.Password = pw > report.Database.Tables(0).ApplyLogOnInfo(LogonInfo) > report.Database.Tables(1).ApplyLogOnInfo(LogonInfo) > report.RecordSelectionFormula = "{History.Weekno} = " & NumWeekno.Text > reportviewer.RunReport(report) > > > > Stephen Plotnick wrote: > >> I am able to create a Crystal report and get it to go to the screen., >> print, >> Excel, etc. >> >> What I want to do now is allow for my VB.NET (2003) program to >> dynamically >> build a "WHERE clause" >> >> For example; >> >> I have 4000 records in an Access DB and I'm displaying Name, Address, >> State, >> ZIP. At this time all 4000 records are being displayed. I want to the >> user >> to print all customers in "IL". How can I build this request in the >> VB.NET >> program and than call the form where the Crystal report is located and >> display only records for "IL". >> >> Thanks in advance, >> Steve > reportviewer.RunReport(report)
Gives me an error. Am I mssing something that needs to added somewhere? Show quoteHide quote "Alex" <aritc***@dashcomputer.co.uk> wrote in message news:1157532311.935093.219560@h48g2000cwc.googlegroups.com... > Hi Stephan > > There are 2 ways of doing this, You can create a datatable or dataset > with your where clause and pass it to your report like this: > > //dbmodtimeSheet, is a database class you would use ExecuteScaler etc > like you would normally do to get the datatable. > > dim dt as new datatable > dim report as As New TimeSheetReporta > dt = dbmodtimeSheet.GetDataTable("SELECT * FROM History WHERE Name = > 'ARITCHIE'") > report.SetDataSource(dt) > reportviewer.RunReport(report) > > Or you could, use the report filter to do it, which is the way I > prefer. > > //NewTimeSheetReporta is the name of your report. > dim report as As New TimeSheetReporta > //LogonInfo is set up to prevent it asking you for the login all the > time. > LogonInfo.ConnectionInfo.UserID = user > LogonInfo.ConnectionInfo.Password = pw > report.Database.Tables(0).ApplyLogOnInfo(LogonInfo) > report.Database.Tables(1).ApplyLogOnInfo(LogonInfo) > report.RecordSelectionFormula = "{History.Weekno} = " & NumWeekno.Text > reportviewer.RunReport(report) > > > > Stephen Plotnick wrote: > >> I am able to create a Crystal report and get it to go to the screen., >> print, >> Excel, etc. >> >> What I want to do now is allow for my VB.NET (2003) program to >> dynamically >> build a "WHERE clause" >> >> For example; >> >> I have 4000 records in an Access DB and I'm displaying Name, Address, >> State, >> ZIP. At this time all 4000 records are being displayed. I want to the >> user >> to print all customers in "IL". How can I build this request in the >> VB.NET >> program and than call the form where the Crystal report is located and >> display only records for "IL". >> >> Thanks in advance, >> Steve > Well you need to put a report viewer on a form somewere and the
"TimeSheetReporta" report object needs to be a report you have created in your project other then that I cnat think what else you need Stephen Plotnick wrote: Show quoteHide quote > reportviewer.RunReport(report) > > Gives me an error. Am I mssing something that needs to added somewhere? > > "Alex" <aritc***@dashcomputer.co.uk> wrote in message > news:1157532311.935093.219560@h48g2000cwc.googlegroups.com... > > Hi Stephan > > > > There are 2 ways of doing this, You can create a datatable or dataset > > with your where clause and pass it to your report like this: > > > > //dbmodtimeSheet, is a database class you would use ExecuteScaler etc > > like you would normally do to get the datatable. > > > > dim dt as new datatable > > dim report as As New TimeSheetReporta > > dt = dbmodtimeSheet.GetDataTable("SELECT * FROM History WHERE Name = > > 'ARITCHIE'") > > report.SetDataSource(dt) > > reportviewer.RunReport(report) > > > > Or you could, use the report filter to do it, which is the way I > > prefer. > > > > //NewTimeSheetReporta is the name of your report. > > dim report as As New TimeSheetReporta > > //LogonInfo is set up to prevent it asking you for the login all the > > time. > > LogonInfo.ConnectionInfo.UserID = user > > LogonInfo.ConnectionInfo.Password = pw > > report.Database.Tables(0).ApplyLogOnInfo(LogonInfo) > > report.Database.Tables(1).ApplyLogOnInfo(LogonInfo) > > report.RecordSelectionFormula = "{History.Weekno} = " & NumWeekno.Text > > reportviewer.RunReport(report) > > > > > > > > Stephen Plotnick wrote: > > > >> I am able to create a Crystal report and get it to go to the screen., > >> print, > >> Excel, etc. > >> > >> What I want to do now is allow for my VB.NET (2003) program to > >> dynamically > >> build a "WHERE clause" > >> > >> For example; > >> > >> I have 4000 records in an Access DB and I'm displaying Name, Address, > >> State, > >> ZIP. At this time all 4000 records are being displayed. I want to the > >> user > >> to print all customers in "IL". How can I build this request in the > >> VB.NET > >> program and than call the form where the Crystal report is located and > >> display only records for "IL". > >> > >> Thanks in advance, > >> Steve > >
Registry Reading
Remove certain characters from a string/RichTextBox? [Regular Expression] extraction when bounds are vbCr and vbLf Better way to process many conditions with If Then Determining max number of characters in a TextBox datagridview.SelectedRows returns last row first? Book Recommendations Request Break up string, Comma Delimited Intellisense XML Comments / Documentation SQL Server |
|||||||||||||||||||||||