Click here to Skip to main content
15,899,313 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
I have read articles in many forums on the subject but I could not find what I was looking for

i want open cyrstal repor with query

like get data to datagridview

What I have tried:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       Dim parametre As New ParameterValues
       Dim deger As New ParameterDiscreteValue
       Dim rapor2 As New CrystalReport2
       deger.Value = F_AracGiderTakibi.aranan
       parametre.Add(deger)
       rapor2.DataDefinition.ParameterFields("PLAKA").ApplyCurrentValues(parametre)

       CrystalReportViewer1.ReportSource = rapor2

   End Sub
Posted
Updated 13-Mar-20 4:25am
Comments
ZurdoDev 13-Mar-20 9:54am    
There are over 1 million articles on how to open a crystal report. What exactly is your question?
Member 14588284 13-Mar-20 10:11am    
i saif first messeage i read too many articles but i Didnt find my answer

1 solution

Dim ds As New DataSet
        Dim cn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\VeriTabanı\Veritabanı.mdb" & ";Persist Security Info=False;")
        cn.Open()
        With F_AracGiderTakibi
           
            sorgu = "select " & F_AracGiderTakibi.SUTUNLAR.Text & " from ARACTAKIP WHERE " & _
         " TARIH  BETWEEN  @d1 and @d2 AND PLAKA LIKE '" & .PLAKA.Text & "%' ORDER BY  PLAKA,TARIH,SAAT"
            Dim cmd As OleDbCommand = New OleDbCommand(sorgu, cn)
            cmd.Parameters.Add("@d1", SqlDbType.Date).Value = .ILKTAR.ValidateText
            cmd.Parameters.Add("@d2", SqlDbType.Date).Value = .SONTAR.ValidateText
            cmd.CommandType = 1
            cmd.Connection = cn
            cmd.ExecuteNonQuery()
            Dim adapter As OleDbDataAdapter = New OleDbDataAdapter

            adapter.SelectCommand = cmd
            adapter.Fill(ds)
        End With


        Dim report As New CrystalReport2

        report.SetDataSource(ds.Tables(0))

        CrystalReportViewer1.ReportSource = report
        CrystalReportViewer1.Refresh()



i find my own solution.
 
Share this answer
 
v2
Comments
Member 14588284 13-Mar-20 16:18pm    
cyrstalreport dont work ohter pc
i didnt instal it. alwaysgives error
How can i use theese codes iin reportviewer?

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