it defaults to the name specified
If the Query
SELECT * FROM PRODUCTS
//Fill the dataset object.
sqlData.Fill(inboundTables,"ASD");
So we can use
DataView dv = ds.Tables["ASD"].DefaultView ;
But if there are multiple Queries then next table name
will default to ASD1 and so on.....
But what u can do is that call all the subsequent using
Command Object.
The following code was tested.
try
{
SqlConnection sqlConn =
new SqlConnection("Initial Catalog=NorthWind;Data Source=
[];User ID=[];Password=[];");
//Open the Connection.
sqlConn.Open();
//TODO: DataReader can be
used for faster access.
DataSet inboundTables =
new DataSet();
string query = "SELECT *
FROM PRODUCTS";
SqlCommand sqlCmd = new
SqlCommand();
sqlCmd.Connection =
sqlConn;
sqlCmd.CommandText =
query;
//Create DataAdapter
object and Attach the SqlCommand Object.
SqlDataAdapter sqlData =
new SqlDataAdapter(sqlCmd);
//Fill the dataset object.
sqlData.Fill
(inboundTables,"PRODUCTS");
query = "SELECT * FROM
ORDERS";
sqlCmd.CommandText =
query;
//Fill the dataset object.
sqlData.Fill
(inboundTables,"ORDERS");
sqlConn.Close();
return inboundTables;
}
catch(Exception ex)
{
throw ex;
}
-Vineet Batta
MCAD
VineetBatta
-----Original Message-----
when using a dataadapter to fill a dataset from a query that returns
multiple tables such as:
Select col1, col2, col3 from tableA
Select col1, col2, col3 from tableB
the DataTable names inside the dataset will not be named with the actual
name.
Is there a way i can go around this?
.