Last post Feb 23, 2011 02:18 AM by Wenchao Zeng - MSFT
Feb 16, 2011 04:53 AM|svibuk|LINK
in my vb.net windows application i have crystal reports implemented
for making it work properly after deploying on client side i have
the below code
.ServerName = ConfigurationManager.AppSettings(
'YOUR SERVER NAME"
.DatabaseName = ConfigurationManager.AppSettings(
'YOUR DATABASE NAME"
.UserID = ConfigurationManager.AppSettings(
'YOUR DATABASE USERNAME"
.Password = ConfigurationManager.AppSettings(
'YOUR DATABASE PASSWORD"..............................................
but when ever i tried to open the report or even in design mode click verify database it ask me for the password
once the passwrod is assigned the report is dispalyed propely
buti dont want to ask it for the password everytie i need to view or open the report
Feb 16, 2011 05:59 AM|rvdwerf|LINK
Did you not forgot to apply the logon information?
in your case something like:
Feb 16, 2011 06:08 AM|amitpatel.it|LINK
Please use below code that with this you can able to resolve your problem.
string DatabaseServer = ConfigurationManager.AppSettings["Server"];
string userId = ConfigurationManager.AppSettings["Userid"];
string Password = ConfigurationManager.AppSettings["Password"];
string DataBaseName = ConfigurationManager.AppSettings["DataBase"];
ReportDocument crReportDocument = new ReportDocument();
crReportDocument.Load(AppDomain.CurrentDomain.BaseDirectory + "/Reports/rpData.rpt");
ConnectionInfo crConnectionInfo = new ConnectionInfo();
TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
//ConfigurationLocation objConnectionLocation = new ConfigurationLocation();
crConnectionInfo.ServerName = DatabaseServer;
crConnectionInfo.DatabaseName = DataBaseName;
crConnectionInfo.UserID = userId;
crConnectionInfo.Password = Password;
crConnectionInfo.IntegratedSecurity = false;
crConnectionInfo.Type = ConnectionInfoType.SQL;
CrTables = crReportDocument.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
crtableLogoninfo = CrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
//CrTable.Location = DataBaseName + ".dbo." + CrTable.Name;
Feb 16, 2011 06:35 AM|svibuk|LINK
thisis the code that i have
'YOUR DATABASE PASSWORD"
' Dim ReportName As String = "individual_bill.rpt"
ReportName = Application.StartupPath &
CrTables = ReportForm.Database.Tables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrystalReportViewer1.ReportSource = ReportForm
Feb 16, 2011 06:44 AM|amitpatel.it|LINK
After looks to you code I found that there are no data binding in availale in code so I think that you have added at desing tome.
So remove that from desing time and add that part from run time with below code.
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString);
SqlCommand cmd = new SqlCommand("exec MyData", conn);
cmd.CommandType = CommandType.Text;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet Ds = new DataSet();
CrystalReportViewer1.ReportSource = crReportDocument;
Please mark as answer if this is helos
Feb 16, 2011 07:09 AM|svibuk|LINK
culd u plz explain in detail
i am doing this for first time
my sceanrio is in this way
i have a total of 6 reports of which 5 are generated with data directly from the tables
so this 5 reports links i have given to the main mdi form
on which i have as
dim firstreport as new frmone
1)i have taken a form with crystal reportviewer in it
2) designed the crystal report seperately from the drag drop of fields frm the table at design time (one.rpt)
3) set the reportsource of crystalviewer to one.rpt
4) in the code window of the form conatining crystalviewer i have added the above code
for the 6th report which is genereated based on the record selection of the form i have taken dataset & populated it with the record as "select * from table1 where name= '" & drpdwnname.selectedvalue.text & "'"
& on this form on a button click i need to dislay the report
how do i design at run time?
and one mor ethig i have put all the reports in a folder REPORTS
but it was not accepting . so i have copied all that reports in BIN folder
so the report is taken frm bin folder. is there any way that it taken from report folder only
Feb 17, 2011 04:35 AM|svibuk|LINK
culd i get any help for crystal report issue
Feb 23, 2011 02:18 AM|Wenchao Zeng - MSFT|LINK
For Crystal Reports related questions, I think the following forums will be more helpful for you:
Reports for Visual Studio (in MSDN)
Hope this helps.