I will talk about the situation of the crystal report in this article. The most common problem that users may encounter when accessing the corresponding crystal report is that they need to log on after opening the report. Why? I have not set a password. How can I enter a password? If you are calm enough, if your debug experience is not lacking, you will find
I will talk about the situation of the crystal report in this article. The most common problem that users may encounter when accessing the corresponding crystal report is that they need to log on after opening the report. Why? I have not set a password. How can I enter a password? If you are calm enough, if your debug experience is not lacking, you will find
I will talk about the situation of the crystal report in this article. In terms of the corresponding crystal report in ACCESS, the most common problem may be that after opening the report
You may need to log on.
Why? I have not set a password. How can I enter a password? If you are calm enough, if your debug experience is not lacking,
You will find that in the login box that jumps out of the Crystal Report and enters the password, the access path is not the location where my current database is placed, it is still when I am Coding
The selected database address. Why didn't he change? In fact, why is the address changed?
This problem may not occur when you use a public server, because no matter which client you use, the server address will not change. However, you use access,
When the database changes to the computer, the server address also changes, but the address in your code does not change. This is the cause of the problem! Do you understand?
It is actually a simple truth.
What should we do? Old Rules: Check the code.
'Database connection DBConnection. connectionString = DB_CnStr () DBConnection. open () 'starts to query Dim SQL As New System. text. stringBuilder Dim DT As New DataTable SQL. append ("SELECT * from wordinfo") Dim cmd As New OleDb. oleDbCommand (SQL. toString, DBConnection) Dim RS As OleDb. oleDbDataAdapter = New OleDb. oleDbDataAdapter (cmd) DT = New DataTable RS. fill (DT) DBConnection. close () 'is the query in the database, and the query result is displayed in the crystal report. 'Define the report location first, then define a report page, and then a Dim reportPath As String = Application that automatically logs on to the database. startupPath & "/" & "CrystalReport. rpt "Dim rptDoc As New CrystalDecisions. crystalReports. engine. reportDocument Dim logonInfo As New CrystalDecisions. shared. tableLogOnInfo rptDoc. load (reportPath) 'here is the information for setting database logon. If there is an account and password in ACCESS, it is filled in. If not, it is all blank. 'If other databases, for example, the name of the server and database must be logonInfo. connectionInfo. serverName = "" logonInfo. connectionInfo. databaseName = "" logonInfo. connectionInfo. userID = "" logonInfo. connectionInfo. password = "" rptDoc. database. tables (0 ). applyLogOnInfo (logonInfo) 'OK. You have logged on to the database above. The following shows how to load the data source rptDoc IN THE CRYSTAL REPORT. setDataSource (DT) rptDoc. refresh () 'the contents of the crystal report are all available. It is better to use reportview to display the report below. CrystalReportViewer1.ReportSource = rptDoc CrystalReportViewer1.Refresh ()
This code is used to dynamically load the data source of the crystal report. This is a professional statement!
The design of the Crystal Report can be pushed or pulled in two ways: push and pull! To put it bluntly, it is also a dynamic and static data source. The use of Crystal Reports is also very simple. Here I just
Use ACCESS to explain the crystal report. Of course, to learn more advanced or detailed things, you need to study it yourself. People who often use CSDN must know that there is
A report master: atai. You can go to his blog to see what a major is. Here I won't go into the crystal report. Oh, I can't afford to lose this person!