
21/06/2005, 16:07
|
| | Fecha de Ingreso: julio-2002 Ubicación: Potosí-Bolivia
Mensajes: 215
Antigüedad: 22 años, 7 meses Puntos: 0 | |
Hola Rootk, este es mi codigo, pero no me funciona!!:S
private void btnCalcular_Click(object sender, System.EventArgs e)
{
String strCn = ConfigurationSettings.AppSettings["miconexion"];
SqlConnection conexion = new SqlConnection(strCn);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter();
Int32 i ;
DataTable temp = new DataTable();
DataColumn col = new DataColumn();
DataColumn col1 = new DataColumn();
DataRow fila;
col = temp.Columns.Add("kardex",Type.GetType("System.Str ing"));
col1 = temp.Columns.Add("valores", Type.GetType("System.String"));
col.AllowDBNull = false;
col.Unique = false;
for(i=0; i<=dgrVenta.Items.Count; i++)
if ( ((CheckBox)dgrVenta.Items[i].Cells[0].FindControl("chk")).Checked )
{
fila = temp.NewRow();
fila[0]= dgrVenta.Items[i].Cells[1].Text;
fila[1]= dgrVenta.Items[i].Cells[2].Text;
temp.Rows.Add(fila);
sql = "Insert into archivo_venta( venta_cod_kardex, venta_nombre_valor) Values (@kardex, @valor)";
da.SelectCommand = new SqlCommand(sql, conexion);
da.SelectCommand.Parameters.Add("@kardex", SqlDbType.NVarChar, 20);
da.SelectCommand.Parameters["@kardex"].Value = dgrVenta.Items[i].Cells[1].Text;
da.SelectCommand.Parameters.Add("@valor", SqlDbType.NVarChar, 50);
da.SelectCommand.Parameters["@valor"].Value = dgrVenta.Items[i].Cells[2].Text;
}
}
}
}
}
__________________ Rodeate de buenos y tu lo pareceras..rodeate de genios y algo en ti se quedará... |