Solved

Wierd dataset problem, table name not showing correctly.

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now