Click here to Skip to main content
11,790,613 members (62,527 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# MySQL
I was wondering if I could give names to the tables that are returned in the MYSQL result in order to access them with .NET through their name.

For example the table that returns the states of America must call States:
Select * from states
name of the result table should call “States”

And I could access the tables in the query’s result like that:

[edit]Tags updated - Maciej Los[/edit]
Posted 16-Oct-12 1:57am
Edited 16-Oct-12 11:38am
Maciej Los200.9K
Toniyo Jackson at 16-Oct-12 8:02am
Are you saying that you have to use states instead of States?
n.podbielski at 16-Oct-12 14:56pm
Then just use keyword AS.
Maciej Los at 16-Oct-12 18:03pm
Not clear. If you know from which table you want to get data, where is a problem?

Have you seen this question and onetwitch answer?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Please refer this article it has all the answers you need.[^]

Important: There is no direct way to provide datatable name straight from stored procedure or sql query.
Maciej Los at 16-Oct-12 18:24pm
I think OP wants to get the name of table from sql query command and to create a dataset/datatable object with the "name" which is equal to the "name of table".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 1,114
1 Maciej Los 825
2 KrunalRohit 686
3 CPallini 611
4 ppolymorphe 610

Advertise | Privacy | Mobile
Web04 | 2.8.1509028.1 | Last Updated 16 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100