5
I have a Store Procedure in SQL Server that projects various data. Example:
CREATE PROCEDURE [dbo].[teste_sp]
AS
BEGIN
select * from compra
select * from cliente
select * from fatura
END
However, when retrieving Dataset in C#, table names are shown as: "Table1", "Table2" and "Table3".
Is there any way to name these tables dynamically?
What do you mean by naming DYNAMICALLY?
– PauloHDSousa
I can manually set in c# the table name (
DataSet.Tables[0].TableName = "Nome"
), but I look for a way to name these tables within the database. So I can retrieve the tables by name and not only by index.– Zack Stone
How do you bring the data to C#?
– Leonel Sanches da Silva
I use
using (SqlDataReader reader = ExecuteReader(CommandBehavior.CloseConnection)
and load the tables making an iteration:while (!reader.IsClosed) { dt.Load(reader); ds.Tables.Add(dt); }
– Zack Stone