Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal.net help on windows application making reports 1

Status
Not open for further replies.

gzuhlk

Programmer
Jul 11, 2003
9
0
0
US
How would I pass the value of a windows form textbox (the user will enter text) to a crystal report.

I am new to crystal reports and need help with this.

What I am trying to do is a form letter type report that will have the users name on it. This will customize the report for every user.

Also how would this be done with a windows combo box that is not hooked up to the database, and a combo box that is hooked to the database?

Thanks for any help on the subject!
G
 

Try this!!!

after creating schema for your report, pass the DataSet as follows: (make appropriate amendments as per your requirement)

Dim rpt As New CrystalReport1() 'The report you created.
Dim myConnection As SqlConnection
Dim MyCommand As New SqlCommand()
Dim myDA As New SqlDataAdapter()
Dim myDS As New Dataset1() 'The DataSet you created.

Try
myConnection = New SqlConnection("Data Source=localhost;Integrated Security=SSPI;" & _
"Initial Catalog=northwind;")
MyCommand.Connection = myConnection
'I am using CustomerID specified by user, similarly you can use ItemNo specified by the user
MyCommand.CommandText = "SELECT * FROM Customers" & _
" WHERE CustomerID = " & "'" & TextBox1.Text & "'"
MyCommand.CommandType = CommandType.Text
myDA.SelectCommand = MyCommand

myDA.Fill(myDS, "Customers")
rpt.SetDataSource(myDS)
rpvReport.ReportSource = rpt

Catch Excep As SqlClient.SqlException
MessageBox.Show(Excep.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try


Email: pankajmsm@yahoo.com
 
Thanks for the reply. I am desperate. I know how to interact with the dasebase field. But in this situation I don't want to use the database to hold this information.

What I am trying to do is simply pass the information the user types in the text box on the form, to the report.

ex.
On my windows form: txtInfo.txt, the user types-- blah, blah blah.

How can I pass this string to a "text field on the report".

Thanks again.
G
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top