Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

hi,

 

iam working as a software engineer in vb.net

iam very new to vb.net

 

i have been given a task of populating data to crystal report from vb.net classes,printing should be very fast.

 

i have done some pretty work on displaying crystal reports from vb.net using crystal report viewer.

 

but now i had a very tough situation...

 

i need to do the following things

1)Design a windows form with a simple combobox which takes all the batch ids from foxpro database.

2)When a batchid is selected and a button called "Print Orders" is Clicked,this batch id should be passed as a parameter to class.

 

2)The data should be fetched from more than three tables

 

3)All the data should be populated to crystal report through classes,so that there is no coupling of database and report directly.

 

 

so what is the meaning of populating data from classes to crystal reports?

 

could any body please tell me how to go forward to make it successfull.i have been trying to find out the approach from the last two days.can any body give me the idea.....

 

if would be very thankful if somebody provides me a some sample code.......

 

iam drawing the flow....

 

 

windows forms(Reports)

|

|

|

vb.net class (which should fetch data for the report)

|

|

|

Foxpro database

 

regards

varma

Posted

after you have created your dataset pass it to the form that will display your report and set the forms private dataset variable to the dataset being passed to the form

 


   Private m_dsReportSource As System.Data.DataSet


  
Public Sub New(ByVal dsReportSource As System.Data.DataSet)
       MyBase.New()


       'This call is required by the Windows Form Designer.
       InitializeComponent()


       'Add any initialization after the InitializeComponent() call


        ' set the forms dataset variable to passed dataset


       m_dsReportSource = dsReportSource


   End Sub

 

then setup your report as follows....

 


Private Sub CrystalReportViewer1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Load

        myReport = New repWhatEver()


        myReport.SetDataSource(m_dsReportSource)


        Me.CrystalReportViewer1.ReportSource = myReport


End Sub

My website
Posted

getting query engine error,crystal reports,vb.net,foxpro

 

hi,

iam working on an orderprocessing application.

i wrote the following code

Dim empReport As New PackSlip()

Dim cnn As New OdbcConnection()

Dim empAdapter As OdbcDataAdapter

Dim empDS As DataSet

Dim strQryString As String

Dim strQryString1 As String

strQryString = "Select Orders.order_num,Orders.status,Orders.batch_id,Orders.cost_code,Orders.st_fname,Orders.st_mname,Orders.st_lname,Orders.st_add1,Orders.st_add2,Orders.st_add3,Orders.st_city,Orders.st_state,Orders.st_zip,Orders.st_zip4,Orders.st_cntry,Orders.st_intzip,Orders.deliv_inst,Orders.comments,ship_methods.descrip from orders,ship_methods"

strQryString1 = "Select ship_methods.descrip from ship_methods"

 

Try

cnn.ConnectionString = "DSN=Visual FoxPro Database;UID=;PWD=;SourceDB=C:\Bowne\POC\temp\data

1. dbc;SourceType=DBC;Exclusive=No;BackgroundFetch=No

;Collate=Machine"

cnn.Open()

empAdapter = New OdbcDataAdapter(strQryString, cnn)

empDS = New DataSet()

empDS.EnforceConstraints = False

empAdapter.Fill(empDS, "Orders")

empAdapter.Fill(empDS, "ship_methods")

empDS.EnforceConstraints = True

empReport.SetDataSource(empDS)

Catch oleEX As OdbcException

MessageBox.Show(oleEX.Message)

Catch RepEX As Exception

MessageBox.Show(RepEX.Message)

End Try

CrystalReportViewer1.ReportSource = empReport

 

the above code prints orders whose shipping method is same

the relation is

orders.reg_or_on=ship_methods.id.

 

i created this relation in the xsd file.

i created the crystal reports with this xsd file as data source.

i created the same relation with crystal database linking export.

 

the main aim is to get the data for the reports using relation between two tables.

 

but iam getting

Query Engine Error:'C:|Docume~1\buddha.r\LOCALS~1\Temp\temp_4a6fc71-4a9d-403c-beb1-388c-4b23a16d.rpt'

 

what may be the problem with this .

should i need to do any thing other than creating relation ships or use joins.

 

if so how should i create relation...

 

please give suggestions...

 

regard

varma

Posted

I create a single dataset with the an SQL statement that returns all the required records from multiple tables.

 

I think that was is easier than the way you are doing it

My website
  • 2 weeks later...
Posted
I create a single dataset with the an SQL statement that returns all the required records from multiple tables.

 

I think that was is easier than the way you are doing it

piggybacking on this thread..

 

do we have to add the dataset and dataadapter from the toolbox or can we declare them in the code?

 

really confused now.. :-\

 

-ashrobo

Posted
I start off with adding a dataset and data adapter on the form to be used at design time in order to get all the fields I require at design time. I then create the dataset and data adapter at run time which will contain the users required data knowing the field names exist on the form.
My website

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...