Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
alfa
Starting Member
2 Posts |
Posted - 2004-06-14 : 18:19:43
|
Please help me.Hi I am using vb.net.I am trying to view a crystal report(crystal report10) and i am connecting to sqlserver.I am supplying database logon information through my code,but it's still prompting for password.When i supplies the password when it prompts everything runs fine.Can anyone suggest why is it?Thankx in advance |
|
gpl
Posting Yak Master
195 Posts |
Posted - 2004-06-14 : 18:26:19
|
As I remember, you have to iterate through each table (proc) in the code to assign the login credentials - sorry its all so long ago |
 |
|
alfa
Starting Member
2 Posts |
Posted - 2004-06-15 : 12:23:00
|
Thanks gpl,Figured out.Thanks for getting me throughThe Table has subreport ,so the database logging information was not accepting by the subreport.we have to specify for each.the code is Dim ci As New CrystalDecisions.Shared.ConnectionInfo Dim tloi As New CrystalDecisions.Shared.TableLogOnInfo 'all the parameters will be added to this collection Dim pfs As New ParameterFields 'the parameter field to be send to the rreport Dim pf As New ParameterField 'Dim pv As ParameterValues 'the above declared parameter filed accepts value as discrete objects 'so declaring the objects Dim pdv As New ParameterDiscreteValue With ci .ServerName = _dl.ServerName .DatabaseName = _dl.database .UserID = _dl.UserID .Password = _dl.Password End With ' the parameter filed to be passed pf.ParameterFieldName = "@UnitNum" 'setting the value of discrete objects pdv.Value = "12" 'adding dicrete values to parameters pf.CurrentValues.Add(pdv) pfs.Add(pf) 'add hte parameter collection to crystal report viewer CRViewer.ParameterFieldInfo = pfs Dim db = rpt.Database Dim Tables = db.Tables Dim Table As CrystalDecisions.CrystalReports.Engine.Table For Each Table In Tables tloi = Table.LogOnInfo tloi.ConnectionInfo = ci Table.ApplyLogOnInfo(tloi) Next |
 |
|
|
|
|