Solved

Wierd dataset problem, table name not showing correctly.

Posted on 2006-07-03
2
207 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

773 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