Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

display field items in CR

Status
Not open for further replies.

santosh1

Programmer
Apr 26, 2002
201
US
I selected the field items from the fields explorer table in crystal report. When I run the report, the field items are not displayed. How do I display the fields from the table in the fields explorer?

Thanks in advance.
 
Do you mean the field names?

Crystal will create default Text Objects with the name of the fields in the page header if you place the fields in the Details Section.

If you're not getting any data, then you should select the lightning bolt to refresh data, if you still don't get anything, than there probably isn't any data, but more information is required to determine your problem.

You can also right click any field and select browse data to see if the field has naything in it.

-k
 





Thanks for the suggestions. This is my first time using Crystal Report w/ VB.Net, and I do appreciate all your help very much.

I put the database fields in the details section from the field explorer, still the field items are not displayed in the Crystal Report when I run the report. I checked the database table if it has the field items
that I want to display, and it does. I did browse data, and it does have a field value that I want to display. Since the field items that I place in crystal report is from
this table, I thought it should be displayed when I run the report.
Below is a sample code from the load event of crystal report viewer. Is there something in the code or am I doing it wrong?
What can I do to display the field items in the report? Thanks much in advance.



Private Sub CrystalViewer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CrystalViewer.Load, MyBase.Load
Dim rpt As New CrystalReport1()
Dim myconnection As OleDbConnection
Dim mycommand As New OleDbCommand()
Dim myDA As New OleDbDataAdapter()
Dim myDS As New DataSet()
Dim strSQL As String
Dim conn As OleDbConnection

strSQL = "SELECT StreetAddress, City, State, Zipcode, Country "
strSQL += "FROM Employee_Address"

Try

conn = New OleDbConnection(mvarConnectionString)


myDA = New OleDbDataAdapter(strSQL, mvarConnectionString)
conn.Open()



myDA.Fill(myDS, "Crystal Report")
rpt.SetDataSource(myDS)

Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo

For Each tbCurrent In rpt.Database.Tables
tliCurrent = tbCurrent.LogOnInfo
With tliCurrent.ConnectionInfo
.ServerName = " "
.UserID = " "
.Password = " "
.DatabaseName = " "
End With
tbCurrent.ApplyLogOnInfo(tliCurrent)
Next tbCurrent

CrystalReportViewer.ReportSource = rpt
CrystalReportViewer.Visible = True
CrystalReportViewer.Zoom(100)
CrystalReportViewer.RefreshReport()

Catch ex As OleDbException
MsgBox(ex.Message, MsgBoxStyle.Critical, "SQL Error")
Exit Sub

Catch exc As Exception
' Unable to connect to SQL Server
MessageBox.Show("Bind Data Grid Failed.")
Exit Sub
Finally
rpt.Dispose()
conn.Close()
conn.Dispose()
myDS.Dispose()
myDA.Dispose()
End Try

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top