setting crystal report using sqldatasource in visual studio 2008

It’s been several days I looking for connecting crystal report express for visual studio 2008 using sqldatasource, so i can edit the sql query using code behind on runtime. All I found on the net are using dataset or xsd, so more coding required πŸ™‚
But finally I found it in microsoft site, with a few simple steps:
– Create crystal report file.
– Connect to database and add fields on the report, customize it as you like.
Here I found another problem, the page wide is limited, the maximum size are E size sheet (43.5 inch) in landscape mode. so you need to limit the report page wide or using subreport.
– Create a form page.
– Add component sqldatasource, crystal report source and crystal report viewer.
– Create your query in sql data source.
– In crystal report source do these steps:

– In crystal report viewer, link the report source to crystal report source.
– finished πŸ™‚

so now you can edit the sql query in sql data source in code behind, like for example for the select query in sqldatasource1:
Sqldatasource1.SelectCommand = “[your sql query]”


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s