Click here to Skip to main content
15,908,166 members
Home / Discussions / Database
   

Database

 
AnswerRe: Doubt in a piece of code [Transact-SQL database audit]. Pin
Corporal Agarn14-May-12 4:08
professionalCorporal Agarn14-May-12 4:08 
QuestionOracle Question: Split String into two Pin
Lash2011-May-12 5:57
Lash2011-May-12 5:57 
AnswerRe: Oracle Question: Split String into two Pin
Jörgen Andersson11-May-12 9:08
professionalJörgen Andersson11-May-12 9:08 
AnswerRe: Oracle Question: Split String into two Pin
Lash2011-May-12 9:33
Lash2011-May-12 9:33 
GeneralRe: Oracle Question: Split String into two Pin
Jörgen Andersson11-May-12 9:47
professionalJörgen Andersson11-May-12 9:47 
Questiontimestamp Pin
vijaylumar11-May-12 1:39
vijaylumar11-May-12 1:39 
AnswerRe: timestamp Pin
Eddy Vluggen11-May-12 1:42
professionalEddy Vluggen11-May-12 1:42 
QuestionWhat is database SQL query to display the name of the table only in to datagrid? Pin
LAPEC10-May-12 1:04
LAPEC10-May-12 1:04 
Hello Everyone

I have created a WPF project (C# language) and I also have a MS Access 2007 database.

I'm trying to display the database table name in to datagrid, but i can't figur out the SQL query how to do it. The code below that I wrote it's not correct I think maybe someone can help me please and solve it...

C#
private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            string ConString = ConfigurationManager.ConnectionStrings["ConString"].ConnectionString;
            string CmdString = string.Empty;

            using (OleDbConnection myConnection = new OleDbConnection(ConString))
            {
                CmdString = "SELECT FoodMenu FROM MSysObjects WHERE (FoodMenu Not Like 'MSys*') AND (Type In (1,4,6)) ORDER BY FoodMenu";

                OleDbCommand comm = new OleDbCommand(CmdString, myConnection);
                OleDbDataAdapter sda = new OleDbDataAdapter(comm);
                myConnection.Open();
                DataTable dt = myConnection.GetSchema("Tables");   //Get list of user tables  
                foreach (DataRow dataRow in dt.Rows)
                {
                    DataGridMenuTables.Items.Add(dataRow["FoodMenu"].ToString().Trim());
                    //DataGridMenuTables.ItemsSource = dt.DefaultView;
                }
                //myConnection.Close();
            }
        }


Kind regards

Roni
AnswerRe: What is database SQL query to display the name of the table only in to datagrid? Pin
PIEBALDconsult10-May-12 3:16
mvePIEBALDconsult10-May-12 3:16 
AnswerRe: What is database SQL query to display the name of the table only in to datagrid? Pin
vvashishta10-May-12 4:17
vvashishta10-May-12 4:17 
GeneralRe: What is database SQL query to display the name of the table only in to datagrid? Pin
Eddy Vluggen10-May-12 7:05
professionalEddy Vluggen10-May-12 7:05 
Questionchoosing a database Pin
davood_b8-May-12 1:19
davood_b8-May-12 1:19 
AnswerRe: choosing a database Pin
PIEBALDconsult8-May-12 3:16
mvePIEBALDconsult8-May-12 3:16 
QuestionRe: choosing a database Pin
Eddy Vluggen8-May-12 5:05
professionalEddy Vluggen8-May-12 5:05 
GeneralRe: choosing a database Pin
PIEBALDconsult8-May-12 18:42
mvePIEBALDconsult8-May-12 18:42 
AnswerRe: choosing a database Pin
Eddy Vluggen8-May-12 5:08
professionalEddy Vluggen8-May-12 5:08 
Questionusing xquery to populate a table variable in sql Pin
swjam6-May-12 4:34
swjam6-May-12 4:34 
QuestionRead LFD(log ) file SQLserver 2008 Pin
jojoba20114-May-12 17:38
jojoba20114-May-12 17:38 
AnswerRe: Read LFD(log ) file SQLserver 2008 Pin
Eddy Vluggen4-May-12 23:11
professionalEddy Vluggen4-May-12 23:11 
QuestionRe: Read LFD(log ) file SQLserver 2008 Pin
jojoba20114-May-12 23:19
jojoba20114-May-12 23:19 
AnswerRe: Read LFD(log ) file SQLserver 2008 Pin
Eddy Vluggen4-May-12 23:31
professionalEddy Vluggen4-May-12 23:31 
GeneralRe: Read LFD(log ) file SQLserver 2008 Pin
jojoba20115-May-12 20:31
jojoba20115-May-12 20:31 
GeneralRe: Read LFD(log ) file SQLserver 2008 Pin
Mycroft Holmes5-May-12 23:00
professionalMycroft Holmes5-May-12 23:00 
JokeRe: Read LFD(log ) file SQLserver 2008 Pin
Eddy Vluggen6-May-12 6:08
professionalEddy Vluggen6-May-12 6:08 
AnswerRe: Read LFD(log ) file SQLserver 2008 Pin
Eddy Vluggen6-May-12 0:37
professionalEddy Vluggen6-May-12 0:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.