When I want to update a book, the combobox of the Book goes blank (supposedly I should leave with the data of the book) but when I display the list of authors, categories, etc, and when I change the year of publication or Title of the book I get that message: / please someone who can help me.
THIS IS IN THE LAYER ACCESS TO DATA
public LibroBE ConsultarLibro(String strcod)
{
LibroBE objLibroBE = new LibroBE();
try
{
//Codifique
cnx.ConnectionString = MiConexion.GetCnx();
cmd.Connection = cnx;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "usp_ConsultarLibro";
cmd.Parameters.AddWithValue("@id_Libro", strcod);
cnx.Open();
dtr = cmd.ExecuteReader();
if (dtr.HasRows == true)
{
dtr.Read();
if (dtr["IdLibro"] == DBNull.Value)
{
objLibroBE.Id_Libro = "";
}
else
{
objLibroBE.Id_Libro = dtr["IdLibro"].ToString();
}
if (dtr["Titulo"] == DBNull.Value)
{
objLibroBE.Tit_Libro = "";
}
else
{
objLibroBE.Tit_Libro = dtr["Titulo"].ToString();
}
if (dtr["NomApe_Autor"] == DBNull.Value)
{
objLibroBE.Id_Autor = "";
}
else
{
objLibroBE.Id_Autor = dtr["NomApe_Autor"].ToString();
}
if (dtr["Nombre_Categoria"] == DBNull.Value)
{
objLibroBE.Id_Categoria = "";
}
else
{
objLibroBE.Id_Categoria = dtr["Nombre_Categoria"].ToString();
}
if (dtr["Nombre_Editorial"] == DBNull.Value)
{
objLibroBE.Id_Editorial = "";
}
else
{
objLibroBE.Id_Editorial = dtr["Nombre_Editorial"].ToString();
}
if (dtr["Nombre_Idioma"] == DBNull.Value)
{
objLibroBE.Id_Idioma = "";
}
else
{
objLibroBE.Id_Idioma = dtr["Nombre_Idioma"].ToString();
}
if (dtr["Año_Lanz"] == DBNull.Value)
{
objLibroBE.Año_Lanz = "";
}
else
{
objLibroBE.Año_Lanz = dtr["Año_Lanz"].ToString();
}
THIS IS IN BUSINESS ENTITIES
public class LibroBE
{
private String mvarId_Libro;
public String Id_Libro
{
get { return mvarId_Libro; }
set { mvarId_Libro = value; }
}
private String mvartit_Libro;
public String Tit_Libro
{
get { return mvartit_Libro; }
set { mvartit_Libro = value; }
}
private String mvarId_Autor;
public String Id_Autor
{
get { return mvarId_Autor; }
set { mvarId_Autor = value; }
}
private String mvarId_Categoria;
public String Id_Categoria
{
get { return mvarId_Categoria; }
set { mvarId_Categoria = value; }
}
private String mvarId_Editorial;
public String Id_Editorial
{
get { return mvarId_Editorial; }
set { mvarId_Editorial = value; }
}
private String mvarId_Idioma;
public String Id_Idioma
{
get { return mvarId_Idioma; }
set { mvarId_Idioma = value; }
}
private String mvarAño_Lanz;
public String Año_Lanz
{
get { return mvarAño_Lanz; }
set { mvarAño_Lanz = value; }
}