Ver Mensaje Individual
  #3 (permalink)  
Antiguo 22/12/2009, 03:11
oslar
 
Fecha de Ingreso: marzo-2008
Mensajes: 81
Antigüedad: 16 años, 2 meses
Puntos: 0
Respuesta: trabajando con datagrid..ayuda

este es el codigo para añadir el registro en la bd ,k lo hace correctamente
Código vb:
Ver original
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.         If TextBox1.Text = "" Or TextBox2.Text = "" Then
  3.             MsgBox("debes de meter datos en los textbox")
  4.             TextBox1.Focus()
  5.  
  6.         Else
  7.             Dim sCnn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & " Data Source=C:\negocio\negocio.mdb"
  8.             Dim conex As New OleDb.OleDbConnection
  9.             Dim comm As New OleDb.OleDbCommand
  10.             conex.ConnectionString = sCnn
  11.             comm.Connection = conex
  12.             comm.CommandText = "INSERT INTO usuarios(usuario,contraseña,direccion,poblacion,ciudad,telefono,movil,nif) VALUES('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & TextBox6.Text & "','" & TextBox7.Text & "','" & TextBox8.Text & "')"
  13.             conex.Open()
  14.             comm.ExecuteNonQuery()
  15.             conex.Close()
  16.             MsgBox("Ingreso correcto")
  17.  
  18.         End If
  19.     End Sub