473,725 Members | 2,271 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Crystal Reports Viewer - simple dynamic database problem

Just trying to do a basic crystal report and viewing it with dynamic
sql server database but dont no what i'm doing wrong? I am using
integrated security.
Dim myRpt As crpt1 = New crpt1 'Where crpt1 is an existing crystal
report

'set databse interaction with crystal
Crystalviewer1. LogOnInfo.Item( 0).ConnectionIn fo.DatabaseName =
"mySQLDatabaseN ame"
Crystalviewer1. LogOnInfo.Item( 0).ConnectionIn fo.ServerName =
"mySQLServerNAm e"

Crystalviewer1. ReportSource = myRpt

Nov 21 '05 #1
1 4911

"cantonarv" <ar******@gmail .com> schrieb im Newsbeitrag
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
Just trying to do a basic crystal report and viewing it with dynamic
sql server database but dont no what i'm doing wrong? I am using
integrated security.
Dim myRpt As crpt1 = New crpt1 'Where crpt1 is an existing crystal
report

'set databse interaction with crystal
Crystalviewer1. LogOnInfo.Item( 0).ConnectionIn fo.DatabaseName =
"mySQLDatabaseN ame"
Crystalviewer1. LogOnInfo.Item( 0).ConnectionIn fo.ServerName =
"mySQLServerNAm e"

Crystalviewer1. ReportSource = myRpt


Hi,

use a dataset like this:
http://support.businessobjects.com/c...etdatasets.pdf
or in a ReportInit like this:
Private Sub ReportInit(ByVa l blRefreshLocati on As Boolean)

Dim crSections As Sections
Dim crSection As Section
Dim crReportObjects As ReportObjects
Dim crReportObject As ReportObject
Dim crSubreportObje ct As SubreportObject

Dim crReportDocumen t As ReportDocument
Dim crSubreportDocu ment As ReportDocument

Dim crDatabase As Database
Dim crTables As Tables
Dim crTable As Table
Dim crTableLogOnInf o As TableLogOnInfo
Dim crConnectioninf o As ConnectionInfo

Dim myArrayList As ArrayList = New ArrayList

'declare an instance of the report and the connectionInfo object

crReportDocumen t = New ReportDocument
crConnectioninf o = New ConnectionInfo

crReportDocumen t.Load(mstrRepo rtName)

'pass the necessary parameters to the connectionInfo object
With crConnectioninf o
.ServerName = mstrDBServerNam e
.DatabaseName = mstrDataBaseNam e
End With

'set up the database and tables objects to refer to the current
report
crDatabase = crReportDocumen t.Database
crTables = crDatabase.Tabl es

'loop through all the tables and pass in the connection info
For Each crTable In crTables
crTableLogOnInf o = crTable.LogOnIn fo
crTableLogOnInf o.ConnectionInf o = crConnectioninf o
If blRefreshLocati on Then
crTable.Locatio n = mstrDataBaseNam e & ".dbo." &
crTable.Locatio n.Substring(crT able.Location.L astIndexOf(".") + 1)
End If
crTable.ApplyLo gOnInfo(crTable LogOnInfo)
Next

'set the crSections object to the current report's sections
crSections = crReportDocumen t.ReportDefinit ion.Sections

'loop through all the sections to find all the report objects
For Each crSection In crSections
crReportObjects = crSection.Repor tObjects
'loop through all the report objects to find all the subreports
For Each crReportObject In crReportObjects
If crReportObject. Kind = ReportObjectKin d.SubreportObje ct
Then
'you will need to typecast the reportobject to a
subreport
'object once you find it
crSubreportObje ct = CType(crReportO bject,
SubreportObject )

'open the subreport object
crSubreportDocu ment =
crSubreportObje ct.OpenSubrepor t(crSubreportOb ject.SubreportN ame)

'set the database and tables objects to work with the
subreport
crDatabase = crSubreportDocu ment.Database
crTables = crDatabase.Tabl es

'loop through all the tables in the subreport and
'set up the connection info and apply it to the tables
For Each crTable In crTables
With crConnectioninf o
.ServerName = mstrDBServerNam e
End With
crTableLogOnInf o = crTable.LogOnIn fo
crTableLogOnInf o.ConnectionInf o = crConnectioninf o
If blRefreshLocati on Then
crTable.Locatio n = mstrDataBaseNam e & ".dbo." &
crTable.Locatio n.Substring(crT able.Location.L astIndexOf(".") + 1)
End If
crTable.ApplyLo gOnInfo(crTable LogOnInfo)
Next
End If
Next
Next

crystalReportVi ewer.ReportSour ce = crReportDocumen t

End Sub

Greeting

Thomas Wenning
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
19177
by: Stephan | last post by:
Hi, I'm using Visual Studio 2003 (C#) with the integrated Crystal Report software and have the following question: How can I assign a value (string) to an unbound (string) field in Crystal Report at runtime? Example: private void button1_Click(object sender,
2
13449
by: Sam | last post by:
Hello everyone, I have a table, which contains a picture column, I put URL info into it. "www.myweb.com/1.jpg..." I want to show this picture in my crystal report, I find some samples show the "static" picture in Crystal report, No "Dynamic" one. Can Crystal Report do that? Thanks in advance. Sam
0
426
by: Jason | last post by:
We are developing a VB.NET database application, using windows forms and Microsoft Access. The application requires dynamic reports, where the users change data on the forms, if a report is being shown it will automatically update. To do this we are using the .NET crystal report viewer, which loads a crystal report that we set it's data source at runtime using a dataset. If the user changes data on the data collection form, we update...
19
3876
by: LP | last post by:
I am using (trying to) CR version XI, cascading parameters feature works it asks user to enter params. But if page is resubmitted. It prompts for params again. I did set ReuseParameterValuesOnRefresh="True" in a viewer, but it still doesn't work. Did anyone run into this problem. What's the solution? Please help. Thank you
17
8448
by: Peter Proost | last post by:
Hi Group, I've got an interesting problem, I don't know if this is the right group but I think so because everything I've read about it so far says it's a .net problem. Here's the problem, we're using crystal reports 9 and vb.net and we're using the crystalrepotViewer to show our reports. But every time we open a report the connection to or sql server remains, so if I open 5 forms with the report viewer I've got 5 sleeping connections in...
3
1848
by: Trichy | last post by:
Hi Can any one help me. I added crystal report item to my project .net. After connecting to database , i inserted three columns from table. I ran report in ..net is working fine. My problem, I want to add fouth column from DB to my report. My field viewer is disable, I cann't insert columns from table. Can any one help me to enable field viewer in tool bar.
2
14464
by: Rod | last post by:
We've got an old VB6 application which has 9 Crystal Reports it can print. These 9 reports are considered by our users to be in essence one "report", in the sense that they are all related and they cannot make their business plans without all 9 reports. However, they really are 9 separate reports, 7 of which have sub-reports in them. One of my colleagues has been working on converting them from the VB6 app, to .RPT files which can be...
7
6713
by: Jlo | last post by:
Hi, I have a c# winforms application. When I call the report file, it shows me all the records in the table. How can I make it to call only a particular range. i have the following code Viewer1.ReportSource = Application.StartupPath + "//Label.rpt"; How can I assign it a dataset which have the data of a particular range.
1
1506
by: narpet | last post by:
Hello all... I have a C# forms application that I am developing using MS Visual Studio 2005. I am trying to add some Crystal Reports to this application using the built in Crystal Reports tools with Visual Studio. It seems like it should be pretty straight forward, but no matter what I do I can't get my reports to actually show data. Here's the info: I created a crystal report viewer on a form. I created a crystal report that has a data...
0
8889
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9179
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9116
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3228
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.