Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
VB
Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        Dim con As New SqlConnection("Data Source=DSQL;Initial Catalog=Analizi;Integrated Security=True")

        Dim cmd As New SqlCommand

        Dim ds As New DataSet
        cmd.CommandText = "PrptIsplatniListi2"
        cmd.CommandType = CommandType.StoredProcedure
        con.Open()

        cmd.Parameters.Add("@datum", SqlDbType.Int).Value = "2012"
        cmd.Parameters.Add("@mesec", SqlDbType.Int).Value = "03"
        cmd.Parameters.Add("@matbrbube", SqlDbType.Int).Value = "30"

        cmd.Connection = con



        Dim da As New SqlDataAdapter(cmd)

        da.Fill(ds)



    End Sub


End Class


this is the code that a wrote! AI have createt a new crystal report Item, reoprt.rpt,and a new form with a repot viewer and I want when I click the button in the main form to display a report with the data from the stored procedure!
Posted
Comments
Basmeh Awad 14-May-13 5:51am    
what is the error you are getting??
Voley 14-May-13 6:21am    
I don't have an error, I do'n know how to move on :S :S

1 solution

try this.
After collecting data in dataAdapter fill data set like this and move on..

C#
da.Fill(ds,"TableName")
Dim cryRpt As New ReportDocument
cryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt")
cryRpt.SetDataSource(ds.Tables(0))
CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900