datasource

hi im using vb.net and crystal report for reporting with this code i report in program please change this code to report in fast report
thnks
Dim Cmd1 As SqlDataAdapter = New SqlDataAdapter("Select * from rest where (g2a =" & 2 & ")or (g2a=" & 0 & ") and (lname=N'" & txtlname.Text.Trim & "')", cnn)
            Cmd1.Fill(ds, "rest_tbl") : frmposi.dgv.DataSource = ds.Tables("rest_tbl")
            frmposi.Show()

Comments

  • edited 12:32AM
    Hello,

    1) Call the designer to create the report, then save the report to a file:
    Dim Cmd1 As SqlDataAdapter = New SqlDataAdapter("Select * from rest where (g2a =" & 2 & ")or (g2a=" & 0 & ") and (lname=N'" & txtlname.Text.Trim & "')", cnn)
    Cmd1.Fill(ds, "rest_tbl")
    ' create report instance
    Dim report As New Report
    ' register the dataset
    report.RegisterData(ds)
    ' design the report
    report.Design()
    ' free resources used by report
    report.Dispose()
    

    2) run the existing report:
    Dim Cmd1 As SqlDataAdapter = New SqlDataAdapter("Select * from rest where (g2a =" & 2 & ")or (g2a=" & 0 & ") and (lname=N'" & txtlname.Text.Trim & "')", cnn)
    Cmd1.Fill(ds, "rest_tbl")
    ' create report instance
    Dim report As New Report
    ' load the existing report
    report.Load("report.frx")
    ' register the dataset
    report.RegisterData(ds)
    ' run the report
    report.Show()
    ' free resources used by report
    report.Dispose()
    
  • edited 12:32AM
    hi thanks for your help
    i create a from with the name frmtest and use a report in this form and design it i dont want to design report again
    i want to full my feild with data that include in datasource
    Dim Cmd1 As SqlDataAdapter = New SqlDataAdapter("Select * from rest where(lname=N'" & txtlname.Text.Trim & "')", cnn)
    
    my datasource must full with this code
    thanks
  • edited 12:32AM
    When you design a report, which datasource do you use? Is it the typed dataset, or something else?
  • edited 12:32AM
    hi
    im using report option in toolbox and add it to form then going to design report and in menu data i add a data source after that i design my report then i want filter report with this code when i used crystal report doing this process to report my data
    Dim da As SqlDataAdapter = New SqlDataAdapter("SELECT * from rest where (g1a =" & 1 & ") and (pri=" & 0 & ") and (rest=" & 1 & " or (rest=" & 2 & ")) ", Fn_Get_SqlConnection())
            Dim ds As DataSet = New DataSet
            da.Fill(ds, "rest") : Dim rpt As New cry : rpt.SetDataSource(ds)
            frmreport.CrystalReportViewer1.ReportSource = rpt : frmreport.Show()
    
    thanks for you attention
  • edited 12:32AM
    Ok, use the following code:
    Dim Cmd1 As SqlDataAdapter = New SqlDataAdapter("Select * from rest where (g2a =" & 2 & ")or (g2a=" & 0 & ") and (lname=N'" & txtlname.Text.Trim & "')", cnn)
    Cmd1.Fill(ds, "rest_tbl")
    ' "existing_table_name" is the name of the table in your report
    report.RegisterData(ds.Tables("rest_tbl"), "existing_table_name")
    report.Show()
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.