COMBOBOX C# Y SQL SERVER
Código simple para cargar un ComboBox en C# a partir de una consulta SQL.
using System;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace ResumenDeMacros
public void CargarCombo(ComboBox elCombo)
{
//Definir coneccion SQL
SqlConnection con = new SqlConnection(@"Data Source=miServer ;" +
"user id = miid; password = mipw;Initial Catalog=EMPRESA;Integrated Security=true;");
string textoCmd = "SELECT [NICK] FROM[empresa].[dbo].[View_Inmuebles]";
try
{
//Abrir coneccion
con.Open();
//Ejecutar sentencia SQL
SqlCommand cmd = new SqlCommand(textoCmd, con);
SqlDataReader reader = cmd.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
//Agrear información al combo
elCombo.Items.Add(reader["Nick"].ToString()); //elCombo.Items.Add(reader.GetString(0)); tambien funciona
//elCombo.Items.Add(reader[0].ToString()); tambien funciona
}
}
con.Close();
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
CREAR Y MODIFICAR UN ARCHIVO .TXT
MANEJO DE DIRECTORIOS Y ARCHIVOS
Comprimir y descomprimir archivos
Exportar tablas sql server a csv
Llenar LIST VIEW con tabla SQL SERVER
Crear una gráfica con tabla de SQL SERVER
Llamar un Web API MVC HttpClient
Llamar un Stored Procedure de SQL desde C#
Llamar un Stored Procedure de SQL desde C# para web api
Convertir JSON a Excel con Javascript
Convertir archivo JSON a listado objeto con C#
Servicio Get y POST en TypeScript y C#
Otros
Obtener divisas desde una página bancaria
Links the interes
Run dataset with SP and queries in C#
Llenar un DataSet al ejecutar un Stored Proc
C# Web API Sending Body Data in HTTP Post REST Client
Angular - HTTP POST Request Examples
Working with FormData in Angular 13
YouTube
Crear aplicación ANGULAR con API REST .NET 7 | ✅ Publicar en HOSTING✅