//METODO BUSCAR public DataTable Buscar(DDacfLOCt_Local acfLOCt_Local) { DataTable DtResultado = new DataTable("acfLOCt_Local"); SqlConnection SqlCon = new SqlConnection(); try { SqlCon.ConnectionString = DConexion.CnBDActivo; SqlCommand SqlCmd = new SqlCommand(); SqlCmd.Connection = SqlCon; SqlCmd.CommandText = "usp_B_acfLOCt_Local"; SqlCmd.CommandType = CommandType.StoredProcedure; SqlParameter ParAMBambiente = new SqlParameter(); ParAMBambiente.ParameterName = "@iLOCid"; ParAMBambiente.SqlDbType = SqlDbType.Char; ParAMBambiente.Size = 50; ParAMBambiente.Value = acfLOCt_Local.LOCid; SqlCmd.Parameters.Add(ParAMBambiente); SqlDataAdapter SqlDat = new SqlDataAdapter(SqlCmd); SqlDat.Fill(DtResultado); } catch (Exception ex) { DtResultado = null; } return(DtResultado); }
//METODO EDITAR public string Editar(DDacfLOCt_Local acfLOCt_Local) { string rpta = ""; SqlConnection SqlCon = new SqlConnection(); try { //Código SqlCon.ConnectionString = DConexion.CnBDActivo; SqlCon.Open(); //Establecer el Comando SqlCommand SqlCmd = new SqlCommand(); SqlCmd.Connection = SqlCon; SqlCmd.CommandText = "usp_U_acfLOCt_Local"; SqlCmd.CommandType = CommandType.StoredProcedure; SqlParameter ParLOCid = new SqlParameter(); ParLOCid.ParameterName = "@iLOCid"; ParLOCid.SqlDbType = SqlDbType.Int; ParLOCid.Value = acfLOCt_Local.LOCid; SqlCmd.Parameters.Add(ParLOCid); // SqlParameter ParLOClocal = new SqlParameter(); ParLOClocal.ParameterName = "@sLOClocal"; ParLOClocal.SqlDbType = SqlDbType.VarChar; ParLOClocal.Value = acfLOCt_Local.LOClocal; SqlCmd.Parameters.Add(ParLOClocal); // SqlParameter ParLOCdireccion = new SqlParameter(); ParLOCdireccion.ParameterName = "@sLOCdireccion"; ParLOCdireccion.SqlDbType = SqlDbType.VarChar; ParLOCdireccion.Value = acfLOCt_Local.LOCdireccion; SqlCmd.Parameters.Add(ParLOCdireccion); // // SqlParameter ParSEGMENT = new SqlParameter(); ParSEGMENT.ParameterName = "@sSEGMENT"; ParSEGMENT.SqlDbType = SqlDbType.Char; ParSEGMENT.Value = acfLOCt_Local.SEGMENT; SqlCmd.Parameters.Add(ParSEGMENT); // //Ejecutamos nuestro comando rpta = SqlCmd.ExecuteNonQuery() != 0 ? "OK" : "NO se Actualizo el Registro"; } catch (Exception ex) { rpta = ex.Message; } finally { if (SqlCon.State == ConnectionState.Open) { SqlCon.Close(); } } return(rpta); }