R
Ron Harter
I have setup for select statements to retrieve data from 4 tables. When all
is said and done and I look for certain tables in the returned DataSet I am
unable to locate the table. When I dig into the DataSet I discovered the 4
tables had names of table, table1, table2, and table3.
I expected VS2008 sp1 and SQL Server 2008 developers edition to return the
proper table name from the data base. Has anyone seen this problem? Is it a
problem? I am enclosing the code snippet
DataSet ds = new DataSet();
DbProviderFactory dbProviderFactory =
DbProviderFactories.GetFactory("System.Data.SqlClient");
using (DbConnection conn = dbProviderFactory.CreateConnection())
{
string s =
ConfigurationManager.ConnectionStrings["Events"].ConnectionString;
conn.ConnectionString = s;
conn.Open();
DbCommand cmd = conn.CreateCommand();
cmd.CommandText = "Select * from FixedHolidays Select * from
FloatingHolidays Select * from LostBoats Select * from Events";
DbDataAdapter dbAdapter = dbProviderFactory.CreateDataAdapter();
dbAdapter.SelectCommand = cmd;
dbAdapter.Fill(ds);
foreach (DataTable t in ds.Tables)
{
Console.WriteLine("Table " + t.TableName + " is in DataSet");
}
}
is said and done and I look for certain tables in the returned DataSet I am
unable to locate the table. When I dig into the DataSet I discovered the 4
tables had names of table, table1, table2, and table3.
I expected VS2008 sp1 and SQL Server 2008 developers edition to return the
proper table name from the data base. Has anyone seen this problem? Is it a
problem? I am enclosing the code snippet
DataSet ds = new DataSet();
DbProviderFactory dbProviderFactory =
DbProviderFactories.GetFactory("System.Data.SqlClient");
using (DbConnection conn = dbProviderFactory.CreateConnection())
{
string s =
ConfigurationManager.ConnectionStrings["Events"].ConnectionString;
conn.ConnectionString = s;
conn.Open();
DbCommand cmd = conn.CreateCommand();
cmd.CommandText = "Select * from FixedHolidays Select * from
FloatingHolidays Select * from LostBoats Select * from Events";
DbDataAdapter dbAdapter = dbProviderFactory.CreateDataAdapter();
dbAdapter.SelectCommand = cmd;
dbAdapter.Fill(ds);
foreach (DataTable t in ds.Tables)
{
Console.WriteLine("Table " + t.TableName + " is in DataSet");
}
}