Asp.net and

Sherman

New member
Joined
Jun 26, 2003
Messages
1
Environment: Microsoft Visual Studio Net
Microsoft .NET framework 1.0
Microsoft .NET framework 1.0
SQL Server 2000
Windows 2000 Pro
IIS Personal Web Server

I am having the dickens of a time generating a crystal report using a push method. The report (cfrEmp) exists in the .net solution as well as the dataset schema. I am using the following code to retrieve data from a stored procedure in a SQL database. I then use a dataadapter to populate a dataset (cfrEmpAll) which then becomes the datasource for the crystal report. The stored proc has set no counts on and has no parameters. The report will generate with field labels and report heading, but no data. Like the dataset is not populating. Anyone have any thoughts???

Thanks


Code Follows:
Imports System.Data
Imports System.Data.SqlClient
Imports System.Security

Public Class cfrAllEmpForm
Inherits System.Web.UI.Page
Protected WithEvents CrystalReportViewer2 As CrystalDecisions.Web.CrystalReportViewer

#Region " Web Form Designer Generated Code "

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim MyConnection As SqlConnection
Dim MyAdapter As SqlDataAdapter
Dim MyStoredProc As SqlCommand
Dim MyData As DataSet
Dim oRpt As New cfrEmp()

Connection
Dim strCon As String


strCon = "Server=****; Trusted_Connection=yes; uid=gvldataload; pwd=********; Integrated Security=True; Database=****;"
MyConnection = New SqlConnection(strCon)

select command
MyStoredProc = New SqlCommand()
MyStoredProc.Connection = MyConnection
MyStoredProc.CommandType = CommandType.StoredProcedure
MyStoredProc.CommandText = "cfrLevelAll_sps"

DataAdapter
MyAdapter = New SqlDataAdapter()
MyAdapter.SelectCommand = MyStoredProc

DataSet
MyData = New cfrEmpAll()

MyAdapter.Fill(MyData)
oRpt.Load()
oRpt.SetDataSource(MyData)
CrystalReportViewer2.ReportSource = oRpt
CrystalReportViewer2.DataBind()

End Sub

End Class
 
1. Try with Integrated Security in the connection string

2. Make sure the SP return data when you run in QRY Analyzer with the crudential in the strcon.
 
Back
Top