Actually I'm using Microsoft access 2007 database, I'm not using the SQL Server, maybe you can have a look at the code below and tell me what am I doing wrong...
privatevoid 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);
DataTable dt = myConnection.GetSchema("Tables"); //Get list of user tables foreach (DataRow dataRow in dt.Rows)
//DataGridMenuTables.ItemsSource = dt.DefaultView;
Basically what I'm trying to do is to display the database table name in to datagrid, but i can't figur out the SQL query how to do it, maybe you can help me and solve it...