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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows Form Textbox value to Crystal SQL

Status
Not open for further replies.

DaveRussell

Programmer
Jul 31, 2003
22
CA
is there a way to pass a value from a textbox to be included into the SQL that will create the recordset my Crystal Report uses (crystal report is being viewed on a separate form)?

for example, a textbox on my form has a value of 19. i need to pass that 19 to the WHERE clause in my SQL. is there a way to do that, or would it be easier to just create the dataset on the first form, and use that as the datasource for the report?

any help would be appreciated.

thanks, dave.
 

Dim SQL as String = &quot;SELECT MyField1, MyField2 FROM MyTable WHERE MyID<&quot; & Textbox1.text

Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Thanks for the reply sunaj!

allright, i've gotten that far, now what would be the best way to pass the SQL string var into the crystal report's SQL query?
 
I don't know enough about Crystal reports to say which method is the best, but the most common seems to be to create a dataset and use that as datasource for the crystal report:
Open a connection, create a dataadapter and use it to fill a data set. Set the datasource of the crystalreport to the dataset.


Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top