all groups > visual studio .net general > april 2004 >
You're in the

visual studio .net general

group:

Visual Studio & Crystal Reports - Logon Error



Visual Studio & Crystal Reports - Logon Error Gary Brower
4/30/2004 6:17:08 PM
visual studio .net general: I am using Visual Studio .Net 2003 with Crystal Reports.

I can create a Crystal Report using a SQL server db. Then I create a
seperate vb web form and add a CrystalReportViewer. When I run the form I
get the message "Logon Error". The problem seems to be that Crystal Reports
does not save the login info I use when creating the report. I have tried
to add logon property to a report object but this does not work.

I can assign a dataset (with its own connection string) to a report object
and get it to work that way, howerver - my goal is to create a crystal
report as a web service (so it needs to be self contained - incluing
connection info).

I sure would appreciate any help.

Cheers,
Gary Brower

Re: Visual Studio & Crystal Reports - Logon Error Gary Brower
5/1/2004 1:42:22 PM
Below is how I was able to make things work using a coded connection string.
I would still be (extreemly) interested in anyone else who might have solved
this with out code as I want to publish the Crystal Report as a standalone
web service.

Good luck.......


In Visual Studio Solution Explorer
Right click the project
Add new item
Add Crystal Reports item.
Follow the wizard.

Right click the new report in the solution explorer and publish as a web
service.

Drag a Crystal Reports Viewer from the toolbox to a web form.

Double click the web form to go to the code window and hook up the Crystal
Reports Viewer---Use the following code-------------------------

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here

Dim strConnectionString As String 'Usually get this from the
web.config file.
strConnectionString = "server=MyServerName;uid=my
useridsa;pwd=;database=MyDatabase"

Dim strSQL As String
strSQL = "Select * from tblHotelTransactions"

Dim dsMyData As New DataSet
dsMyData = SqlHelper.ExecuteDataset(strConnectionString,
CommandType.Text, strSQL)

Dim oRpt As New CrystalReport1 'CrystalReport1 is the strongly typed
(the exact report - we just get an instance of it) report we created
(CrystalReport1.rpt).
oRpt.Load()
oRpt.SetDataSource(dsMyData.Tables(0)) 'We just have one table -
number 0
crvMyCrystalReportViewer.ReportSource = oRpt
'crvMyCrystalReportViewer is the control I dragged on the webform and named.

End Sub

----------------------------------------------------------------------------
-----------------------



[quoted text, click to view]

Re: Visual Studio & Crystal Reports - Logon Error Keith
5/1/2004 9:18:40 PM
I had exactly the same problem, but I do not know how to createe it's own
connection string.

Can you please tell me how you did that?

Thanks


[quoted text, click to view]

AddThis Social Bookmark Button