i think its easy too solve u guys...
-
hi all, i am using crystal report in my project. when i am passing the following code then only i can view the values through viewer,otherwise it displaying crystal report engine failed error. my question is --- How can i display the values in viewer without using this lines(thts mean without passing this connection). crConnectionInfo.ServerName = "server1" crConnectionInfo.DatabaseName = "DevReg" crConnectionInfo.UserID = "sa" crConnectionInfo.Password = "sa" crDatabase = CRYRpt1.Database crTables = crDatabase.Tables For Each crtable In crTables crTableLogOnInfo = crtable.LogOnInfo crTableLogOnInfo.ConnectionInfo = crConnectionInfo crtable.ApplyLogOnInfo(crTableLogOnInfo) Next any answers are welcome. regards rs_net
-
hi all, i am using crystal report in my project. when i am passing the following code then only i can view the values through viewer,otherwise it displaying crystal report engine failed error. my question is --- How can i display the values in viewer without using this lines(thts mean without passing this connection). crConnectionInfo.ServerName = "server1" crConnectionInfo.DatabaseName = "DevReg" crConnectionInfo.UserID = "sa" crConnectionInfo.Password = "sa" crDatabase = CRYRpt1.Database crTables = crDatabase.Tables For Each crtable In crTables crTableLogOnInfo = crtable.LogOnInfo crTableLogOnInfo.ConnectionInfo = crConnectionInfo crtable.ApplyLogOnInfo(crTableLogOnInfo) Next any answers are welcome. regards rs_net
hi Try this piece of code!
ReportDocument rptDoc = new ReportDocument(); TableLogOnInfo tblLogInf = new TableLogOnInfo(); rptDoc.Load( <Report Path> ); foreach( Table tbl in rptDoc.Database.Tables ) { tblLogInf = tbl.LogOnInfo; tblLogInf.ConnectionInfo.ServerName = <Database Server Name> tblLogInf.ConnectionInfo.DatabaseName = <Database Name> tblLogInf.ConnectionInfo.UserID = <User ID> tblLogInf.ConnectionInfo.Password = < Password> rptDoc.Database.Tables[tbl.Name].ApplyLogOnInfo(tblLogInf); rptDoc.Database.Tables[tbl.Name].Location = <Database Name> + .dbo. + tbl.Name; }
Manoj 'Doing what u like is Freedom, Liking what u do is Happiness'