hi
i have developed crystal reports (
vb.NET 2003 version)
it asks for Login and server name etc.
i mena in report viewer login window comes .. this happens when the server is changed
for example client side or installatin site..
but in my code i am also allocating login info and stuff run time.
belolw is the code that does that
-----------------------------------------------------------
rep.Load(Application.StartupPath & "\report\" & rptFileName)
' loading rpt file
'-- below constr is the connection string info for SQL server
'-- i am splitting information to get server name and pwd and uid stuff from app.config file ia
have made
'
Private Sub InitializeReport()
rep.Load(Application.StartupPath & "\report\" & rptFileName)
Dim tempservinfo() As String = Split(strConnect, ";")
Dim server, database, uname, pword
server = Split(tempservinfo(0), "=")
database = Split(tempservinfo(1), "=")
If tempservinfo.Length > 3 Then
uname = Split(tempservinfo(2), "=")
pword = Split(tempservinfo(3), "=")
Else
uname = ""
pword = ""
End If
rep.SetDatabaseLogon(uname(1), pword(1), server(1), database(1))
Dim MyLogonInfo As CrystalDecisions.Shared.TableLogOnInfo
Dim MyTable As CrystalDecisions.CrystalReports.Engine.Table
For Each MyTable In rep.Database.Tables
MyLogonInfo = MyTable.LogOnInfo
If (MyTable.Name = "") Then
MyLogonInfo.ConnectionInfo.UserID = uname(1)
MyLogonInfo.ConnectionInfo.Password = pword(1)
MyLogonInfo.ConnectionInfo.ServerName = server(1)
MyLogonInfo.ConnectionInfo.DatabaseName = database(1)
Else
MyLogonInfo.ConnectionInfo.UserID = uname(1)
MyLogonInfo.ConnectionInfo.Password = pword(1)
MyLogonInfo.ConnectionInfo.ServerName = server(1)
MyLogonInfo.ConnectionInfo.DatabaseName = database(1)
MyTable.ApplyLogOnInfo(MyLogonInfo)
End If
Next
CrystalReportViewer1.ReportSource = rep
' rep variable is report document
CrystalReportViewer1.LogOnInfo(0).ConnectionInfo.S erverName = server(1)
CrystalReportViewer1.LogOnInfo(0).ConnectionInfo.D atabaseName = database(1)
CrystalReportViewer1.LogOnInfo(0).ConnectionInfo.U serID = uname(1)
CrystalReportViewer1.LogOnInfo(0).ConnectionInfo.P assword = pword(1)
CrystalReportViewer1.SelectionFormula = rptSelectFormula
End Sub
-------------------------------------------------------------------------
in above code everything works fine i have checked while doing debugging and all information
goes properly but then also that login window comes
also the thing is i am not using tables straight away in reports for data
i am using view and qeries i have built in databse.
any help would be helpfull ASAP plz
thanx in advance
Nilesh