This is my code and I want to dynamically make a query to my database without having to put values to the parameters department and university since that data I get from a dropdownlist, as I could in that case I am working in visual studio
protected void Page_Load(object sender, EventArgs e)
{
DataTable Tabla;
if (!IsPostBack)
{
//SqlConnection conexionSQL = new SqlConnection("Data Source=(localdb)\bdprueba; Initial Catalog=BDUbicaciones;Integrated Security=True");
SqlConnection conexionSQL = new SqlConnection("Data Source=192.168.1.107;Initial Catalog=GestionVoluntarios;User ID=st;Password=juli12");
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "select id,Latitud,Longitud,Nombres,Apellidos,Direccion,(select Nombre from dbo.tbwbDepartamento where id=Departamento)Departamento,Telefono,Correo from tbwbVoluntario where (status=1) and Departamento ='19' and Universidad ='15' and latitud <>'0' and longitud <>'0'";
cmd.CommandType = CommandType.Text;
cmd.Connection = conexionSQL;
conexionSQL.Open();
Tabla = new DataTable();
Tabla.Load(cmd.ExecuteReader());
Repeater1.DataSource = Tabla;
Repeater1.DataBind();
conexionSQL.Close();
}
}