[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 236
  • Last Modified:

Wierd dataset problem, table name not showing correctly.

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
ParanoidOne
Asked:
ParanoidOne
1 Solution
 
Bob LearnedCommented:
' Fill a DataSet, using an alias.
adapter.Fill(ds, "table")  

Bob
0
 
ParanoidOneAuthor Commented:
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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now