Solved

Wierd dataset problem, table name not showing correctly.

Posted on 2006-07-03
2
209 Views
Last Modified: 2010-04-23
I have a complex SQL statement in my dataadapter and for some reason the table name in the dataset is an SQL statement ? Well referencing this is a huge problem. I have renamed the table in the dataset and my program just crashed, having to delete the dataset and remake it again. Here is the SQL statement for the dataadapter.

Select R.CustomerID, R.Customer, R.ShipDate, S1.Sold, S1.[Time] From
(Select C.CustomerID,C.Customer,Max(S.Sold) As ShipDate From Customer C Inner Join Sales S On C.CustomerID = S.CustomerID Group By C.CustomerID,C.Customer) R
Inner Join
Sales S1 As R.CustomerID = S1.CustomerID And S1.Shipped = R.ShipDate

Maybe there is a way to do an alias ?
0
Comment
Question by:ParanoidOne
2 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 250 total points
ID: 17033032
' Fill a DataSet, using an alias.
adapter.Fill(ds, "table")  

Bob
0
 

Author Comment

by:ParanoidOne
ID: 17033108
What is ended up being was this line.

Me.TABLENAME.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "TABLENAME", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("ID", "NO"), New System.Data.Common.DataColumnMapping("ShipDate", "ShipDate"), New System.Data.Common.DataColumnMapping("TB_DATE", "TB_DATE"), New System.Data.Common.DataColumnMapping("TB_TIME", "TB_TIME")})})

The tablename was an SQL statement, I guess it could not interpret the tablename and threw in the select statement, truncated. I changed it here since the designer got confused. But in turn I have made a mistake when I did a copy and paste and was filling the datatable with the wrong dataadapter, I did not change the adapter name when I pasted, just the table name. So point go to you for makeing me look.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question