Good morning, I would like to know how I can extract all the rows of a certain field in variables (String) using C #.
For example:
Campo = Usuario
rows of said field:
Juan
Ana
Jose
put them in variables like this:
String nombre1 --> Juan
String nombre2 --> Ana
String nombre3 --> Jose
PS: I use sqlserver
PD2: I have the following fields: Id_User
, Usuario
and Pass
Enclosed current code:
conexion.Open();
SqlCommand cmd = conexion.CreateCommand();
SqlDataReader reader = cmd.ExecuteReader();
reader.Read();
string nombre = reader.GetString(1);
int cant = nombre.Count();
conexion.Close();