Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s
Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s
Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s
Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s
Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s
Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s
Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s
Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s
Go Back  Xtreme Visual Basic Talk > > > Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s


Reply
 
Thread Tools Display Modes
  #21  
Old 09-11-2004, 05:23 PM
Davearia's Avatar
Davearia Davearia is offline
Junior Contributor
 
Join Date: Jul 2004
Location: In A Perfect Cadence
Posts: 358
Default


Here is the project zip hopefully this will help.

Thanks, Dave.
Attached Files
File Type: zip W_D_P_Reports.zip (539.4 KB, 0 views)
Reply With Quote
  #22  
Old 09-13-2004, 02:05 PM
Davearia's Avatar
Davearia Davearia is offline
Junior Contributor
 
Join Date: Jul 2004
Location: In A Perfect Cadence
Posts: 358
Question Crystal Report Cannot Find DataSource!

Hi all,

Here is the most relevant part of my code:
Code:
Dim MySQLSelect As String = "SELECT bc_stock.wo_num, bc_stock.st_qty, bc_stock.ch_prod_da, bc_stock.bar_code, bc_stock.ST_CODE, bc_stock.ST_DESC, bc_stock.ST_LOCN, stktrn.mm_date FROM stktrn LEFT OUTER JOIN bc_stock ON stktrn.CH_KEY = bc_stock.BAR_CODE WHERE bc_stock.ST_QTY = 94"
Dim MyConnectionString As String = "data source=(local);initial catalog=wen;integrated security=SSPI;"
Dim MyConnection As New SqlDataAdapter(MySQLSelect, MyConnectionString)
Dim MyDataset As New DataSet
MyDataset.Clear()
MyConnection.Fill(MyDataset, "stktrn")
MyConnection.Fill(MyDataset, "bc_stock")
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor
Cursor.Show()
Try
      Report1.SetDataSource(MyDataset)
      CrystalReportViewer3.ReportSource = Report1
Catch ex As Exception
      MessageBox.Show(ex.Message, "Could not create report",MessageBoxButtons.OK)
Finally
      Cursor.Current = System.Windows.Forms.Cursors.Default
      Cursor.Show()
End Try
I have been experimenting with the form this code belongs to. This form fills a dataset which will be used to populate a Crystal Report. I was having all kinds of strange events when creating the report. So I decided to break things down. Instead of the report, I had a DataGrid on the form and left everything else as it was.
Code:
Dim MySQLSelect As String = "SELECT bc_stock.wo_num, bc_stock.st_qty, bc_stock.ch_prod_da, bc_stock.bar_code, bc_stock.ST_CODE, bc_stock.ST_DESC, bc_stock.ST_LOCN, stktrn.mm_date FROM stktrn LEFT OUTER JOIN bc_stock ON stktrn.CH_KEY = bc_stock.BAR_CODE WHERE bc_stock.ST_QTY = 94"
Dim MyConnectionString As String = "data source=(local);initial catalog=wen;integrated security=SSPI;"
Dim MyConnection As New SqlDataAdapter(MySQLSelect, MyConnectionString)
Dim MyDataset As New DataSet
MyDataset.Clear()
MyConnection.Fill(MyDataset, "stktrn")
MyConnection.Fill(MyDataset, "bc_stock")
DataGrid1.DataSource = MyDataset
The main point I want to make is that the DataGrid worked perfectly and the results of the SQL statement appeared exactly as I would of expected, which with all of my previous attempts with reports I have not managed this. This to me proves that the code in the form is okay.

On the other hand my report does not appear to have any data source. When I go to the report and look for data sources there doesn't appear to be any.

I am starting to think that as my dataset etc are created at runtime that maybe my Crystal Report also should be created at runtime. As all of my data environment is created at runtime is it necesssary for me to create my report there aswell? Or can you tell me how I can get a datasource at designtime in my Crystal Report?

Thanks, Dave.
Reply With Quote
  #23  
Old 09-13-2004, 02:31 PM
Davearia's Avatar
Davearia Davearia is offline
Junior Contributor
 
Join Date: Jul 2004
Location: In A Perfect Cadence
Posts: 358
Default Put More Simply!

To summarize what I am asking. If you create a Dataset at runtime as I have, can you use this dataset in a Crystal Report that was created before runtime?

If the answer is yes then how can I access this Dataset from my Crystal Report?

Thanks, Dave.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s
Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s
Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s
Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s
Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s
Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s
Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s
Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s
 
Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s
Storing Results Of SQL Statement That Uses Two Tables Into Dataset/s
 
-->