martes, 27 de octubre de 2020

FOR LOOP SQL Server

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;


lunes, 12 de octubre de 2020

Visual Studio desactivar debug ContextSwitchDeadlock

 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






domingo, 11 de octubre de 2020

Convertir DataReader a DataTable C# (SqlDataReader to DataTable)

 Puede cargar un archivo DataTabledirectamente 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;
                    }



jueves, 8 de octubre de 2020

Reporting services en visual studio 2019

 Para poder ver los proyectos de reportes en VS 2019 es necesario instalar el siguiente complemento.


Extensions/ Manage Extensions