cancel
Showing results for 
Search instead for 
Did you mean: 

VB.NET - Crystal Report blank database

Former Member
0 Kudos

I've created a simple report application that view our monthly payment. But when I click the button view. It prompts the Database Login.

Server name: HAS VALUE

Database: NO VALUE

Login ID: HAS VALUE

Password: HAS VALUE

The problem is, the Database field is blank. But I've checked the SQL Database. The database is existing.


Me.Text = "" & oCompany.CompanyName & " - Payment Schedule Report"
  
Dim iCon As New System.Drawing.Icon(xPath & "\AppIcon1.ico")
  
Me.Icon = iCon
  
Me.WindowState = FormWindowState.Maximized
  ComboBox1
.Text = "Choose Export Format"

  
Dim oConnectInfo As New ConnectionInfo
  
Dim oCRTableInfos As New TableLogOnInfos
  
Dim oCRTableInfo As New TableLogOnInfo
  
Dim oTables As Tables
  
Dim oTable As Table

  cryRpt
= New ReportDocument

  cryRpt
.Load(xPath & "\Rpt\App_BuyerLedger.rpt")

  
With oConnectInfo
  
'MsgBox(oCompany.CompanyDB)
  
.ServerName = "" & oCompany.Server & ""
  
.DatabaseName = oCompany.CompanyDB
  
.UserID = "" & oCompany.DbUserName & ""
  
.Password = "p@ssw0rd"
  
.Type = ConnectionInfoType.SQL
  
End With

  oTables
= cryRpt.Database.Tables
  
For Each oTable In oTables
  
'oCRTableInfo = oTable.LogOnInfo
  oCRTableInfo
.ConnectionInfo = oConnectInfo
  oTable
.ApplyLogOnInfo(oCRTableInfo)
  
Next

  oCRTableInfos
.Add(oCRTableInfo)

  oParameter
()

  CrystalReportViewer1
.EnableRefresh = True
  CrystalReportViewer1
.LogOnInfo = oCRTableInfos
  CrystalReportViewer1
.ReportSource = cryRpt
  
'CrystalReportViewer1.Refresh()

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Bryan,

Please search first... see this thread -

Don't Add the table, it already exists.

' oCRTableInfos.Add(oCRTableInfo)


And if it's a Store Procedure set the parameter values first.


Only reason it would prompt and values blank is the app can't find the Client, or you are adding a table that doesn't need to be.


Don

Former Member
0 Kudos

Hi ,

     What do you mean "And if it's a Store Procedure set the parameter values first." I'm using stored procedure in my report.

Regards,

0 Kudos

Move your line of code...

  oParameter()


  oTables = cryRpt.Database.Tables
  
For Each oTable In oTables
  
'oCRTableInfo = oTable.LogOnInfo
  oCRTableInfo
.ConnectionInfo = oConnectInfo
  oTable
.ApplyLogOnInfo(oCRTableInfo)
  
Next

  'oCRTableInfos
.Add(oCRTableInfo)

Not that hard to figure out....


Don

Former Member
0 Kudos

Oh I see. Thanks . But still the same.

0 Kudos

Did you use my test app to figure this out? If not try it.... run in debug mode so you can see what is happening in the parameter collection and values being sent.

Don

Former Member
0 Kudos

Hi ,

     Yes, I used it. In my machine. It is working. But in client your app and my add-on have the same output.

See image:

Also when trying to login. It says No Datasource or logon failed.

Regards,

0 Kudos

And as I said, the reason for those fields being blank or not editable is because the client PC does not have the DB client installed or it is not available to your app.

Check it. If you use a report with saved data and hit the refresh button it should prompt for log on on info, again, if it's is un-editible or missing info it's because the app cannot find the client

Add debugging code to your app so you can see if the info is being set correctly.

Don

Former Member
0 Kudos

What do you mean DB Client? The workstation that I'm testing is also a stand alone system. Which have database engine and SAP server.

And after debugging, all information like credentials are set correctly.

0 Kudos

It still needs a client installed.

From the screen shot of my test app it is using OLE DB to connect. Try using the IP address of your PC rather than the name. Could be your DNS look up is not up to date.

I assume after changing that connection info you did click on the Set Logon button correct?

Don

Former Member
0 Kudos

I don't understand what is DB Client.

Yes, I've click Set Logon button indeed after changing the connection.

0 Kudos

DB Client is Database Client.

One way to check is open 32 bit ODBC administrator and you'll see the clients you have installed:

If the users PC doe snot have them installed the app is not going to find them and CR will not show or populate the connection info.

Don

Answers (0)