Getting TableName only from Northwind Database.....Can someone help

Jan 19 2007 4:15 PM
Hi,

I have a simple problem. All I need is a simple program that provides only tableName from Northwind Database.

What SQL Query should I write.

In the following code, I need to provide tableName (so that I can get DataSet object. I need to get a new tableName from
Northwind database at every iteration and pass the tableName to this method.

I need help.......



/****************************************/
private DataSet ReturnDataSet(tableName)
{
DataSet dataSet = null;
string sqlStatement = "select * from " + tableName;

try
{
using (SqlConnection sqlConnection = new SqlConnection(connectionInfo))
using (SqlCommand sqlCommand = new SqlCommand(sqlStatement, sqlConnection))
{
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
dataSet = new DataSet();
sqlDataAdapter.Fill(dataSet, tableName);

}

}
catch
{
//Log the exception.
}
return dataSet;

}//End ReturnDataSet


Sanjeev


Answers (1)