Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Wierd dataset problem, table name not showing correctly.

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

789 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