473,322 Members | 1,425 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

How to populate SQL statement to crystal report ???

Hi All,

I don't why I can't populate SQL statement to crystal report ???
Please help
My Source Code Here

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim strSQL As String
Dim MyReport2 As New S21SalesReport
Dim myDS As New DataSet

'Dim myConnection As New SqlClient.SqlConnection
'myConnection.ConnectionString =
"Server=abcServer;Database=MyDB;User
ID=sa;Password=12345;Trusted_Connection=False "

'Dim MyCommand As New SqlClient.SqlCommand
'MyCommand.Connection = myConnection

strSQL = "SELECT * FROM YTDSO017 "
If Me.DropDownList1.SelectedValue <> "ALL" Then
strSQL += "WHERE DIVB=" & Me.DropDownList1.SelectedValue
Response.Write(strSQL)
End If

'MyCommand.CommandText = strSQL

'MyCommand.CommandType = CommandType.Text

'Dim MyDA As New SqlClient.SqlDataAdapter(MyCommand)

'This is our DataSet created at Design Time
'MyDA.Fill(myDS)

'MyReport2.SetDataSource(myDS)
MyReport2.SetDatabaseLogon("usera", "usera")

Me.CrystalReportViewer1.SelectionFormula = strSQL

Me.CrystalReportViewer1.ReportSource = MyReport2

Me.CrystalReportViewer1.DataBind()

Me.CrystalReportViewer1.DisplayGroupTree = False

Me.CrystalReportViewer1.RefreshReport()

Nov 21 '05 #1
0 910

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: kristoff plasun | last post by:
I have a problem with a C++ DCOM application that prints Crystal Reports with data from Oracle. The SQL query is relatively complex but when the report is printed from the Crystal Reports...
0
by: Dr. Indera | last post by:
hello, i previously posted the questions below on several crystal reports newsgroups, including the one for the company that makes crystal reports, but never got an answer, so i'm hoping that...
0
by: Peter | last post by:
How to populate text hello into a Crystal Report using C#. Any help. Thanks.
0
by: Pierre | last post by:
Hi, Can anyone tell me how I can populate a Crystal Report, using a DataTable in C#? Regards, Pierre
2
by: Pierre | last post by:
Hi, Can anyone tell me how I can populate Crystal Reports, using a DataTable in C#? Regards, Pierre
1
by: Karthic | last post by:
When i right click on the .rpt file in the VS 2003, i see a property printer setting. It says "No printer" on the top and there is option to select printer and paper settings etc.. I want to...
1
by: Sachin | last post by:
Hi, I am working on ASP.Net 2.0 Beta 2 I am having problems creating crystal report using dataset I created a new dataset (DS_ExpCode) and a datatable (DT_ExpCode) under App_Code folder....
1
by: Deepthi | last post by:
Hai... I am doing an application in Vb.net. Here i have to display report by getting the values taht are displayed in a treeview in one form. How to Pass those values to the crystal report and...
11
by: =?Utf-8?B?cmtibmFpcg==?= | last post by:
How can I stop receiving this message while calling a crystal report? "The report you requested requires further information." Thanks
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.