C# .NET - Dataset retrival in Crystal Report with logon parameters

Asked By Garvitkumar Choraria on 07-Feb-14 06:42 AM
My Present Code: cryRpt.Load(Application.StartupPath + "\\VideoBill.rpt");
crconnection.ServerName = Common.DefaultDatabasePath;(server name coming from a common class) crconnection.DatabaseName = DatabaseName; (database name defined in the top of the page)
crconnection.UserID = "Admin";
crconnection.Password = "Password";
cryRpt.SetDataSource(dsreport.Tables[0]);
crtables = cryRpt.Database.Tables;

foreach (CrystalDecisions.CrystalReports.Engine.Table Crtable in crtables)
                        {
                            crtableinfo = Crtable.LogOnInfo;
                            crtableinfo.ConnectionInfo = crconnection;
                            Crtable.ApplyLogOnInfo(crtableinfo);
                        }
                        
crystalReportViewer1.ReportSource = cryRpt;
crystalReportViewer1.Refresh();


Previously working code :

cryRpt.Load(Application.StartupPath + "\\VideoBill.rpt");
cryRpt.SetDatabaseLogon("Admin", "Password");
cryRpt.SetDataSource(dsreport.Tables[0]);
crystalReportViewer1.ReportSource = cryRpt;

dsreport is filling the value from different dataset called during initialization of the form.

My query is :
in my previous code i was getting only one value inside the crystal report
while i added the current code with logon parameters... i am getting the value of the entire table in the crystal report i.e. all the entries are coming in crystal report
and i want that only my dsreport dataset value should be filled in the crystal report... so what changes should i do in my current coding as the previous coding is not working on the client system so i added the logon parameters code in this form to avoid the logon error in the client system.????
Robbe Morris replied to Garvitkumar Choraria on 07-Feb-14 09:42 AM
Alter your query so that only the rows you want are contained in

dsreport.Tables[0]
Garvitkumar Choraria replied to Robbe Morris on 07-Feb-14 10:07 AM
query is already retrieving only the required value in the dsreport dataset