Click here to Skip to main content
12,955,170 members (59,351 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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
Updated 16-Oct-12 11:38am
Maciej Los253.2K
Toniyo Jackson 16-Oct-12 8:02am
Are you saying that you have to use states instead of States?
n.podbielski 16-Oct-12 14:56pm
Then just use keyword AS.
Maciej Los 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 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
Top Experts
Last 24hrsThis month
OriginalGriff 6,559
CHill60 3,550
Maciej Los 3,153
ppolymorphe 2,030
Jochen Arndt 1,975

Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 16 Oct 2012
Copyright © CodeProject, 1999-2017
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