Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/02/2009, 19:34
yumiles
 
Fecha de Ingreso: febrero-2009
Mensajes: 10
Antigüedad: 15 años, 3 meses
Puntos: 0
problemas con insert para access

Hola alguien me puede decir que es lo que estoy haciendo mal aqui? el codigo no me guarda los registros
Gracias

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim conexion2 As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=inventarioXP.mdb"

Dim strSQL2 As String = "INSERT INTO prueba (id, nombre, apellido) VALUES ('" & TextBox1.Text & "', '" & TextBox2.Text & ", '" & TextBox3.Text & "')"
Dim cmdinsert As New SqlClient.SqlCommand
cmdinsert.CommandText = strSQL2
cmdinsert.Connection = conexion
Try
If ((cmdinsert.ExecuteNonQuery()) <> 0) Then
MsgBox("Nuevo Registro", MsgBoxStyle.OkOnly, "HolA")
End If
Catch ex As Exception
MsgBox("No se pudo insertar")
End Try


End Sub