Tema: Error CS0161
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/09/2005, 14:23
Avatar de Sayra
Sayra
 
Fecha de Ingreso: diciembre-2004
Mensajes: 365
Antigüedad: 19 años, 5 meses
Puntos: 1
Error CS0161

Hola tengo un error que me dice lo siguente

CS0161: 'ASP.Visitante_aspx.LoadData(string)': no todas las rutas de código devuelven un valor

Línea 170: bool LoadData(string sKey)


bool LoadData(string sKey)
{
string sTmp;
bool bRead;

// Get Connection String
string sConnStr = ewdb.ewConnStr();

// Construct SQL statement
string sKeyWrk = "" + sKey + "";
string sSelect = "SELECT * FROM [T_VISITANTE] WHERE [visi_id] = " + sKeyWrk;
lblSql.Text = sSelect;

// Create a new Connection Object using the Connection String
SqlConnection oConn = new SqlConnection(sConnStr);

// Open the Connection to the Database
oConn.Open();

// Create DataReader Object and Get Data from Database
SqlDataReader drWrk = ewdb.ewDataReader(oConn, sSelect);
if (drWrk == null)
{
lblMessage.Text = Convert.ToString(Session["dberrmsg"]);
lblSql.Visible = true;
oConn.Close(); // Close Connection
return false; // Error Return and Stop Execution
}
else
{
lblSql.Visible = false;
}
bRead = drWrk.Read();
if (bRead)
{

// Field empl_id
string sConn_empl_id = ewdb.ewConnStr();
DataView ewdv_empl_id;
string sFilter_empl_id;
sFilter_empl_id = "";
ewdv_empl_id = ewdb.ewDataViewLink(sConn_empl_id, "T_EMPLEADOS", "empl_id", "empl_nom", "empl_ape", "", "", "", false, sFilter_empl_id);
if (ewdv_empl_id == null)
{

//x_empl_id.Items.Insert(0,new ListItem(Convert.ToString(Session["dberrmsg"]),""));
}
else
{
x_empl_id.DataSource = ewdv_empl_id;
x_empl_id.DataTextField = "ewTextField";
x_empl_id.DataValueField = "ewValueField";
x_empl_id.DataBind();
x_empl_id.Items.Insert(0,new ListItem("Please Select",""));
if (drWrk["empl_id"] != DBNull.Value)
{
foreach (ListItem li_empl_id in x_empl_id.Items)
{
if (Convert.ToString(li_empl_id.Value) == Convert.ToString(drWrk["empl_id"]))
{
li_empl_id.Selected = true;
}
}
}
}

// Field visi_nom
if (drWrk["visi_nom"] != DBNull.Value)
{
x_visi_nom.Text = Convert.ToString(drWrk["visi_nom"]);
}

// Field visi_ape
if (drWrk["visi_ape"] != DBNull.Value)
{
x_visi_ape.Text = Convert.ToString(drWrk["visi_ape"]);
}

// Field visi_ced
if (drWrk["visi_ced"] != DBNull.Value)
{
x_visi_ced.Text = Convert.ToString(drWrk["visi_ced"]);
}



// Close DataReader
drWrk.Close();

// Close connection
oConn.Close();
if (bRead)
{
return true; // Normal Return
}
else
{
return false; // Record not found
}
}
}
// End LoadData

Gracias de antemano