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.
;=)