public bool ExisteProveedor(int rutProveedor)
{
var ds = new DataSet();
Database db;
try
{
db = DatabaseFactory.CreateDatabase("miBD");
using (DbCommand com = db.GetSqlStringCommand("SELECT rut" +
" FROM t_miTabla " +
" WHERE rut = " + rutProveedor))
{
ds = db.ExecuteDataSet(com);
}
}
catch (Exception ex)
{
return false;
}
finally
{
db = null;
}
if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
return true;
else
return false;
}
No hay comentarios:
Publicar un comentario