Ciclo while sql server
Sintaxis
DECLARE @count INT = 0; WHILE @count < cnt_total
BEGIN [sentencia] SET @count = @count + 1;
END;
Ejemplo:
DECLARE @count INT = 0;
WHILE @count < 1000
BEGIN
select @count
SET @count = @count + 1;
END;
Tips de desarrollo SQL SERVER, ASP.NET, C#, MVVM, WCF, WPF, XAMARIN, AZURE etc
DECLARE @count INT = 0; WHILE @count < cnt_total
BEGIN [sentencia] SET @count = @count + 1;
END;
Ejemplo:
DECLARE @count INT = 0;
WHILE @count < 1000
BEGIN
select @count
SET @count = @count + 1;
END;
Error al debugear
Managed Debugging Assistant 'ContextSwitchDeadlock' Message=Managed Debugging Assistant 'ContextSwitchDeadlock' : 'The CLR has been unable to transition from COM context 0x8e0158 to COM context 0x8dffe8 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.'
Debug > Windows > Exception Settings
Puede cargar un archivo DataTable
directamente desde un lector de datos utilizando el Load()
método que acepta un archivo IDataReader
.
var dataReader = cmd.ExecuteReader();
var dataTable = new DataTable();
dataTable.Load(dataReader);
o
var dataTable = new System.Data.DataTable(); var dt = new System.Data.DataTable();
SqlDataReader dr;
dr = cmd.ExecuteReader();
if (dr.Read())
{
dataTable.Load(dr);
dt = dataTable;
}
Para poder ver los proyectos de reportes en VS 2019 es necesario instalar el siguiente complemento.
Extensions/ Manage Extensions