Ver Mensaje Individual
  #3 (permalink)  
Antiguo 23/09/2008, 15:55
Avatar de mvazquez
mvazquez
 
Fecha de Ingreso: octubre-2004
Ubicación: Monterrey - México
Mensajes: 875
Antigüedad: 19 años, 6 meses
Puntos: 8
Respuesta: Casi un problema existencial, ayuda plis!!!

Asi mandas los parametros:
Código:
SqlParameter sqlPram0 = new SqlParameter("@Param1", ValParam1);
List<SqlParameter> Param = new List<SqlParameter>();
Param.Add(sqlPram0);
EjecutarInstruccion(mSqlCnn, NonQuery, "StoredProcedure", Param.ToArray(), 260);
Ejecutas este metodo:
Código:
public object EjecutarInstruccion(SqlConnection mSqlCnn, string TipoEjecucion, string NombreProcedimientoAlmacenado, SqlParameter[] Parametros, int TimeOut)
        {
            SqlCommand sqlCmd;
            object oResultado = null;

            sqlCmd = new SqlCommand();

            try
            {
                if ((mSqlCnn != null) && mSqlCnn.State != ConnectionState.Open)
                {
                    mSqlCnn.Open();
                }

                sqlCmd.CommandText = NombreProcedimientoAlmacenado;
                sqlCmd.Connection = mSqlCnn;
                sqlCmd.CommandTimeout = TimeOut;
                sqlCmd.CommandType = CommandType.StoredProcedure;
                sqlCmd.Parameters.AddRange(Parametros);
                if ((mSqlTran != null))
                {
                    sqlCmd.Transaction = mSqlTran;
                }

                switch (TipoEjecucion)
                {
                    case "NonQuery":
                        oResultado = sqlCmd.ExecuteNonQuery();
                        break;
                    case "Scalar":
                        oResultado = sqlCmd.ExecuteScalar();
                        break;
                }
                return oResultado;
            }

            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (mSqlTran == null)
                {
                    if ((mSqlCnn != null) & mSqlCnn.State == ConnectionState.Open)
                    {
                        mSqlCnn.Close();
                    }
                }
                if ((sqlCmd != null))
                {
                    sqlCmd.Dispose();
                }
            }

        }

y una vez que termine si quieres que se vea refelejado el cambio que te hizo , tienes que volver a cargar tu informacion en el gridview.

si tienes dudas comenta.
;=)
__________________
http://vazquezvega.wordpress.com/
"La paciencia nos da el privilegio de compartir el refrescante fruto de Dios con los demás."