Código
private void Leer() { string cadenaConexion = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; { cnn.Open(); string query1 = string.Empty; query1 = "SELECT id_cursoMateria From CursosMaterias cm Where cm.id_Curso = @idCurso AND cm.id_Materia = @idMateria"; com1.Parameters.AddWithValue("@idCurso", Convert.ToInt32(ViewState["idCurso"])); com1.Parameters.AddWithValue("@idMateria", Convert.ToInt32(ViewState["idMateria"])); int idCursoMateria = Convert.ToInt32(com1.ExecuteScalar()); ViewState["idCursoMateria"] = idCursoMateria; string query2 = string.Empty; query2 = "SELECT A.Dni, A.Apellido, A.Nombre, amc.id_alumMatCurso FROM AlumMatCursos amc INNER JOIN Alumno A ON amc.Id_Alumno = A.Id_Alumno WHERE amc.id_alumMatCurso = @idcurMat"; com2.Parameters.AddWithValue("@idcurMat", idCursoMateria); da.Fill(dt); GridCargaAsistencia.DataSource = dt; GridCargaAsistencia.DataBind(); } }
Nos vemos........