| Author: Reach2Shaik 07 Nov 2009 | Member Level: Gold | Rating:   Points: 3 |
Hi Pavan,
Try this
SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=Test;Integrated Security=True"); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter("Select Name from sysobjects where xtype=" + "'u'", conn); da.Fill(ds); DataTable dt = ds.Tables[0];
Don't forget to rate this answer, if it is helpful... Regards Shaik
|
| Author: Shivraj Singh Rajawat 07 Nov 2009 | Member Level: Bronze | Rating:  Points: 2 |
SELECT name FROM dbo.sysobjects WHERE xtype = 'U'
|
| Author: Shameer 08 Nov 2009 | Member Level: Silver | Rating:  Points: 2 |
string connectionString = "..."; DataTable tables = new DataTable("Tables"); using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand command = connection.CreateCommand(); command.CommandText = "select table_name as Name from INFORMATION_SCHEMA.Tables where TABLE_TYPE = 'BASE TABLE'"; connection.Open(); tables.Load(command.ExecuteReader( CommandBehavior.CloseConnection)); }
|
| Author: Anish Nair 09 Nov 2009 | Member Level: Silver | Rating:  Points: 2 |
select * from sysobjects where type = 'U' - To see list of user tables select * from sysobjects where type = 'S' - To see list of system tables select * from sysobjects where type = 'P' - To see list of stored procedures select * from sysobjects where type = 'V' - To see list of views
Cheer's Be Positive.. Anish.. http://www.dotnetsourcecodes.blogspot.com/
|