Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/06/2004, 15:28
Avatar de RsOfT
RsOfT
 
Fecha de Ingreso: marzo-2002
Ubicación: InterNET
Mensajes: 1.121
Antigüedad: 22 años, 2 meses
Puntos: 7
Como realizar un Insert con ASP.NET

He estado intentando insertar unos datos a una tabla pero no sé.
Hice lo siguiente:
Código:
Dim daRechazo As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter("Select * from RechazoCheque", cnn)
daRechazo.InsertCommand.CommandText = "Insert Into RechazoCheque (clCodigo,rtCodigo,rcMonto,rcFecha) values('01','01',50.0,'01/01/2004')"
Pero me da el siguiente error:
Cita:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 59: Try
Line 60: Dim daRechazo As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter("Select * from RechazoCheque", cnn)
Line 61: daRechazo.InsertCommand.CommandText = "Insert Into RechazoCheque (clCodigo,rtCodigo,rcMonto,rcFecha) values('01','01',50.0,'01/01/2004')"
Line 62:
Line 63: Response.Redirect("ChequeRechazadoGrabado.aspx")


Source File: C:\Joe\Desarrollo\Aplicaciones Web\Liquidacion\RechazarCheque.aspx.vb Line: 61
Cómo le hago para hacer un Insert?
__________________
.::RsOfT::.
--El que se aferra a lo conocido, nunca conocerá lo desconocido--
--Es intentando lo imposible como se realiza lo posible--
--Es de pésimo gusto contentarse con algo mediocre cuando lo excelente está a nuestro alcance--