public System.Collections.Generic.Dictionary<string, string> GetAllTables(System.Data.SqlClient.SqlConnection _connection) { if (_connection.State == System.Data.ConnectionState.Closed) _connection.Open(); System.Data.DataTable dt = _connection.GetSchema("Tables"); System.Collections.Generic.Dictionary<string, string> tables = new System.Collections.Generic.Dictionary<string, string>(); foreach (System.Data.DataRow row in dt.Rows) { if (row[1].ToString().Equals("BASE TABLE", StringComparison.OrdinalIgnoreCase)) //ignore views { string tableName = row[2].ToString(); string schema = row[1].ToString(); tables.Add(tableName, schema); } } _connection.Close(); return tables; }
world wide web development problems asp net php html xhtml css javascript jquery w3dproblems
Thursday, April 17, 2014
How to get name of all tables in ms sql database aspnet c#
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment