• Viernes 8 de Noviembre de 2024, 07:17

Autor Tema:  Vb.net - Databindings  (Leído 1923 veces)

petuh

  • Nuevo Miembro
  • *
  • Mensajes: 1
    • Ver Perfil
Vb.net - Databindings
« en: Miércoles 13 de Diciembre de 2006, 00:40 »
0
tengo una aplicación vb.net con databinding (objetos enlazados a datos) pero los procedimientos de update y delete no funcionan... la conexión, el dataset y el dataadapter funcionan ok, hasta que intento actualizar datos en la BD Access. al principio sacaba un error de que faltaba el UpdateCommand, lo corregí haciendo el Update Command, pero ahora saca error de Concurrency Violation, pues intenta repetir los datos de un registro en los demás de la tabla...

Si alguien tiene conocimiento sobre databinding les agradezco, pues el sw estpa al 90% y solo falta eso... que es lo primordial...

gracias

saintis

  • Nuevo Miembro
  • *
  • Mensajes: 12
    • Ver Perfil
Re: Vb.net - Databindings
« Respuesta #1 en: Viernes 15 de Diciembre de 2006, 04:06 »
0
a ver si te sirve esto lo hice con una base a sql pero nada mas cambiale

Imports System.Data.SqlClient
Public Class Form1
    Inherits System.Windows.Forms.Form
    Private enlaceBase As BindingManagerBase


#Region " Código generado por el Diseñador de Windows Forms "

    Public Sub New()
        MyBase.New()

        'El Diseñador de Windows Forms requiere esta llamada.
        InitializeComponent()

        'Agregar cualquier inicialización después de la llamada a InitializeComponent()

    End Sub

    'Form reemplaza a Dispose para limpiar la lista de componentes.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Requerido por el Diseñador de Windows Forms
    Private components As System.ComponentModel.IContainer

    'NOTA: el Diseñador de Windows Forms requiere el siguiente procedimiento
    'Puede modificarse utilizando el Diseñador de Windows Forms.
    'No lo modifique con el editor de código.
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
    Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
    Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
    Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
    Friend WithEvents SqlDataAdapter1 As System.Data.SqlClient.SqlDataAdapter
    Friend WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection
    Friend WithEvents TextBox6 As System.Windows.Forms.TextBox
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents TextBox7 As System.Windows.Forms.TextBox
    Friend WithEvents Label8 As System.Windows.Forms.Label
    Friend WithEvents TextBox8 As System.Windows.Forms.TextBox
    Friend WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand
    Friend WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand
    Friend WithEvents SqlUpdateCommand1 As System.Data.SqlClient.SqlCommand
    Friend WithEvents SqlDeleteCommand1 As System.Data.SqlClient.SqlCommand
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents Button3 As System.Windows.Forms.Button
    Friend WithEvents DataSet11 As Examen_Final.DataSet1
    Friend WithEvents Button4 As System.Windows.Forms.Button
    Friend WithEvents Button5 As System.Windows.Forms.Button
    Friend WithEvents Button6 As System.Windows.Forms.Button
    Friend WithEvents Button7 As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Label1 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label3 = New System.Windows.Forms.Label
        Me.Label4 = New System.Windows.Forms.Label
        Me.Label5 = New System.Windows.Forms.Label
        Me.TextBox1 = New System.Windows.Forms.TextBox
        Me.DataSet11 = New Examen_Final.DataSet1
        Me.TextBox2 = New System.Windows.Forms.TextBox
        Me.TextBox3 = New System.Windows.Forms.TextBox
        Me.TextBox4 = New System.Windows.Forms.TextBox
        Me.TextBox5 = New System.Windows.Forms.TextBox
        Me.SqlDataAdapter1 = New System.Data.SqlClient.SqlDataAdapter
        Me.SqlDeleteCommand1 = New System.Data.SqlClient.SqlCommand
        Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection
        Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand
        Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand
        Me.SqlUpdateCommand1 = New System.Data.SqlClient.SqlCommand
        Me.TextBox6 = New System.Windows.Forms.TextBox
        Me.Label6 = New System.Windows.Forms.Label
        Me.Label7 = New System.Windows.Forms.Label
        Me.TextBox7 = New System.Windows.Forms.TextBox
        Me.Label8 = New System.Windows.Forms.Label
        Me.TextBox8 = New System.Windows.Forms.TextBox
        Me.Button1 = New System.Windows.Forms.Button
        Me.Button2 = New System.Windows.Forms.Button
        Me.Button3 = New System.Windows.Forms.Button
        Me.Button4 = New System.Windows.Forms.Button
        Me.Button5 = New System.Windows.Forms.Button
        Me.Button6 = New System.Windows.Forms.Button
        Me.Button7 = New System.Windows.Forms.Button
        CType(Me.DataSet11, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(24, 40)
        Me.Label1.Name = "Label1"
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "Cve Doctor"
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(16, 72)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(112, 23)
        Me.Label2.TabIndex = 1
        Me.Label2.Text = "Nombre"
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(16, 104)
        Me.Label3.Name = "Label3"
        Me.Label3.TabIndex = 2
        Me.Label3.Text = "Apellido_Paterno"
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(24, 144)
        Me.Label4.Name = "Label4"
        Me.Label4.TabIndex = 3
        Me.Label4.Text = "Edad"
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(8, 176)
        Me.Label5.Name = "Label5"
        Me.Label5.TabIndex = 4
        Me.Label5.Text = "Telefono"
        '
        'TextBox1
        '
        Me.TextBox1.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.DataSet11, "Doctores.Cve_doctor"))
        Me.TextBox1.Location = New System.Drawing.Point(136, 40)
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.TabIndex = 5
        Me.TextBox1.Text = ""
        '
        'DataSet11
        '
        Me.DataSet11.DataSetName = "DataSet1"
        Me.DataSet11.Locale = New System.Globalization.CultureInfo("es-MX")
        '
        'TextBox2
        '
        Me.TextBox2.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.DataSet11, "Doctores.Nombre"))
        Me.TextBox2.Location = New System.Drawing.Point(136, 72)
        Me.TextBox2.Name = "TextBox2"
        Me.TextBox2.TabIndex = 6
        Me.TextBox2.Text = ""
        '
        'TextBox3
        '
        Me.TextBox3.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.DataSet11, "Doctores.Apellido_Paterno"))
        Me.TextBox3.Location = New System.Drawing.Point(136, 104)
        Me.TextBox3.Name = "TextBox3"
        Me.TextBox3.TabIndex = 7
        Me.TextBox3.Text = ""
        '
        'TextBox4
        '
        Me.TextBox4.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.DataSet11, "Doctores.Edad"))
        Me.TextBox4.Location = New System.Drawing.Point(136, 144)
        Me.TextBox4.Name = "TextBox4"
        Me.TextBox4.TabIndex = 8
        Me.TextBox4.Text = ""
        '
        'TextBox5
        '
        Me.TextBox5.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.DataSet11, "Doctores.Telefono"))
        Me.TextBox5.Location = New System.Drawing.Point(136, 176)
        Me.TextBox5.Name = "TextBox5"
        Me.TextBox5.TabIndex = 9
        Me.TextBox5.Text = ""
        '
        'SqlDataAdapter1
        '
        Me.SqlDataAdapter1.DeleteCommand = Me.SqlDeleteCommand1
        Me.SqlDataAdapter1.InsertCommand = Me.SqlInsertCommand1
        Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand1
        Me.SqlDataAdapter1.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "Doctores", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("Cve_doctor", "Cve_doctor"), New System.Data.Common.DataColumnMapping("Nombre", "Nombre"), New System.Data.Common.DataColumnMapping("Apellido_Paterno", "Apellido_Paterno"), New System.Data.Common.DataColumnMapping("Edad", "Edad"), New System.Data.Common.DataColumnMapping("Telefono", "Telefono"), New System.Data.Common.DataColumnMapping("Direccion", "Direccion"), New System.Data.Common.DataColumnMapping("Cargo_q_Realiza", "Cargo_q_Realiza"), New System.Data.Common.DataColumnMapping("Tiempo_trabajando", "Tiempo_trabajando")})})
        Me.SqlDataAdapter1.UpdateCommand = Me.SqlUpdateCommand1
        '
        'SqlDeleteCommand1
        '
        Me.SqlDeleteCommand1.CommandText = "DELETE FROM Doctores WHERE (Cve_doctor = @Original_Cve_doctor) AND (Apellido_Pate" & _
        "rno = @Original_Apellido_Paterno) AND (Cargo_q_Realiza = @Original_Cargo_q_Reali" & _
        "za) AND (Direccion = @Original_Direccion) AND (Edad = @Original_Edad) AND (Nombr" & _
        "e = @Original_Nombre) AND (Telefono = @Original_Telefono) AND (Tiempo_trabajando" & _
        " = @Original_Tiempo_trabajando)"
        Me.SqlDeleteCommand1.Connection = Me.SqlConnection1
        Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_Cve_doctor", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Cve_doctor", System.Data.DataRowVersion.Original, Nothing))
        Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_Apellido_Paterno", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Apellido_Paterno", System.Data.DataRowVersion.Original, Nothing))
        Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_Cargo_q_Realiza", System.Data.SqlDbType.VarChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Cargo_q_Realiza", System.Data.DataRowVersion.Original, Nothing))
        Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_Direccion", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Direccion", System.Data.DataRowVersion.Original, Nothing))
        Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_Edad", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Edad", System.Data.DataRowVersion.Original, Nothing))
        Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_Nombre", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Nombre", System.Data.DataRowVersion.Original, Nothing))
        Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_Telefono", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Telefono", System.Data.DataRowVersion.Original, Nothing))
        Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_Tiempo_trabajando", System.Data.SqlDbType.VarChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Tiempo_trabajando", System.Data.DataRowVersion.Original, Nothing))
        '
        'SqlConnection1
        '
        Me.SqlConnection1.ConnectionString = "workstation id=PC10;packet size=4096;integrated security=SSPI;data source=PC10;pe" & _
        "rsist security info=False;initial catalog=Hospital"
        '
        'SqlInsertCommand1
        '
        Me.SqlInsertCommand1.CommandText = "INSERT INTO Doctores(Cve_doctor, Nombre, Apellido_Paterno, Edad, Telefono, Direcc" & _
        "ion, Cargo_q_Realiza, Tiempo_trabajando) VALUES (@Cve_doctor, @Nombre, @Apellido" & _
        "_Paterno, @Edad, @Telefono, @Direccion, @Cargo_q_Realiza, @Tiempo_trabajando); S" & _
        "ELECT Cve_doctor, Nombre, Apellido_Paterno, Edad, Telefono, Direccion, Cargo_q_R" & _
        "ealiza, Tiempo_trabajando FROM Doctores WHERE (Cve_doctor = @Cve_doctor)"
        Me.SqlInsertCommand1.Connection = Me.SqlConnection1
        Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Cve_doctor", System.Data.SqlDbType.Int, 4, "Cve_doctor"))
        Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Nombre", System.Data.SqlDbType.VarChar, 20, "Nombre"))
        Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Apellido_Paterno", System.Data.SqlDbType.VarChar, 20, "Apellido_Paterno"))
        Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Edad", System.Data.SqlDbType.Int, 4, "Edad"))
        Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Telefono", System.Data.SqlDbType.Int, 4, "Telefono"))
        Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Direccion", System.Data.SqlDbType.VarChar, 20, "Direccion"))
        Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Cargo_q_Realiza", System.Data.SqlDbType.VarChar, 25, "Cargo_q_Realiza"))
        Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Tiempo_trabajando", System.Data.SqlDbType.VarChar, 25, "Tiempo_trabajando"))
        '
        'SqlSelectCommand1
        '
        Me.SqlSelectCommand1.CommandText = "SELECT Cve_doctor, Nombre, Apellido_Paterno, Edad, Telefono, Direccion, Cargo_q_R" & _
        "ealiza, Tiempo_trabajando FROM Doctores"
        Me.SqlSelectCommand1.Connection = Me.SqlConnection1
        '
        'SqlUpdateCommand1
        '
        Me.SqlUpdateCommand1.CommandText = "UPDATE Doctores SET Cve_doctor = @Cve_doctor, Nombre = @Nombre, Apellido_Paterno " & _
        "= @Apellido_Paterno, Edad = @Edad, Telefono = @Telefono, Direccion = @Direccion," & _
        " Cargo_q_Realiza = @Cargo_q_Realiza, Tiempo_trabajando = @Tiempo_trabajando WHER" & _
        "E (Cve_doctor = @Original_Cve_doctor) AND (Apellido_Paterno = @Original_Apellido" & _
        "_Paterno) AND (Cargo_q_Realiza = @Original_Cargo_q_Realiza) AND (Direccion = @Or" & _
        "iginal_Direccion) AND (Edad = @Original_Edad) AND (Nombre = @Original_Nombre) AN" & _
        "D (Telefono = @Original_Telefono) AND (Tiempo_trabajando = @Original_Tiempo_trab" & _
        "ajando); SELECT Cve_doctor, Nombre, Apellido_Paterno, Edad, Telefono, Direccion," & _
        " Cargo_q_Realiza, Tiempo_trabajando FROM Doctores WHERE (Cve_doctor = @Cve_docto" & _
        "r)"
        Me.SqlUpdateCommand1.Connection = Me.SqlConnection1
        Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Cve_doctor", System.Data.SqlDbType.Int, 4, "Cve_doctor"))
        Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Nombre", System.Data.SqlDbType.VarChar, 20, "Nombre"))
        Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Apellido_Paterno", System.Data.SqlDbType.VarChar, 20, "Apellido_Paterno"))
        Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Edad", System.Data.SqlDbType.Int, 4, "Edad"))
        Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Telefono", System.Data.SqlDbType.Int, 4, "Telefono"))
        Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Direccion", System.Data.SqlDbType.VarChar, 20, "Direccion"))
        Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Cargo_q_Realiza", System.Data.SqlDbType.VarChar, 25, "Cargo_q_Realiza"))
        Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Tiempo_trabajando", System.Data.SqlDbType.VarChar, 25, "Tiempo_trabajando"))
        Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_Cve_doctor", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Cve_doctor", System.Data.DataRowVersion.Original, Nothing))
        Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_Apellido_Paterno", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Apellido_Paterno", System.Data.DataRowVersion.Original, Nothing))
        Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_Cargo_q_Realiza", System.Data.SqlDbType.VarChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Cargo_q_Realiza", System.Data.DataRowVersion.Original, Nothing))
        Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_Direccion", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Direccion", System.Data.DataRowVersion.Original, Nothing))
        Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_Edad", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Edad", System.Data.DataRowVersion.Original, Nothing))
        Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_Nombre", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Nombre", System.Data.DataRowVersion.Original, Nothing))
        Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_Telefono", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Telefono", System.Data.DataRowVersion.Original, Nothing))
        Me.SqlUpdateCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_Tiempo_trabajando", System.Data.SqlDbType.VarChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Tiempo_trabajando", System.Data.DataRowVersion.Original, Nothing))
        '
        'TextBox6
        '
        Me.TextBox6.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.DataSet11, "Doctores.Direccion"))
        Me.TextBox6.Location = New System.Drawing.Point(136, 208)
        Me.TextBox6.Name = "TextBox6"
        Me.TextBox6.TabIndex = 10
        Me.TextBox6.Text = ""
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(16, 208)
        Me.Label6.Name = "Label6"
        Me.Label6.TabIndex = 11
        Me.Label6.Text = "Direccion"
        '
        'Label7
        '
        Me.Label7.Location = New System.Drawing.Point(8, 248)
        Me.Label7.Name = "Label7"
        Me.Label7.TabIndex = 12
        Me.Label7.Text = "Cargo_q_Realiza"
        '
        'TextBox7
        '
        Me.TextBox7.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.DataSet11, "Doctores.Cargo_q_Realiza"))
        Me.TextBox7.Location = New System.Drawing.Point(136, 248)
        Me.TextBox7.Name = "TextBox7"
        Me.TextBox7.TabIndex = 13
        Me.TextBox7.Text = ""
        '
        'Label8
        '
        Me.Label8.Location = New System.Drawing.Point(16, 288)
        Me.Label8.Name = "Label8"
        Me.Label8.Size = New System.Drawing.Size(104, 23)
        Me.Label8.TabIndex = 14
        Me.Label8.Text = "Tiempo_trabajando"
        '
        'TextBox8
        '
        Me.TextBox8.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.DataSet11, "Doctores.Tiempo_trabajando"))
        Me.TextBox8.Location = New System.Drawing.Point(128, 288)
        Me.TextBox8.Name = "TextBox8"
        Me.TextBox8.Size = New System.Drawing.Size(112, 20)
        Me.TextBox8.TabIndex = 15
        Me.TextBox8.Text = ""
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(320, 80)
        Me.Button1.Name = "Button1"
        Me.Button1.TabIndex = 16
        Me.Button1.Text = "Agrega"
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(320, 112)
        Me.Button2.Name = "Button2"
        Me.Button2.TabIndex = 17
        Me.Button2.Text = "Actualizar"
        '
        'Button3
        '
        Me.Button3.Location = New System.Drawing.Point(320, 144)
        Me.Button3.Name = "Button3"
        Me.Button3.TabIndex = 18
        Me.Button3.Text = "Borrar"
        '
        'Button4
        '
        Me.Button4.Location = New System.Drawing.Point(296, 216)
        Me.Button4.Name = "Button4"
        Me.Button4.Size = New System.Drawing.Size(48, 23)
        Me.Button4.TabIndex = 19
        Me.Button4.Text = "<<"
        '
        'Button5
        '
        Me.Button5.Location = New System.Drawing.Point(344, 216)
        Me.Button5.Name = "Button5"
        Me.Button5.Size = New System.Drawing.Size(48, 23)
        Me.Button5.TabIndex = 20
        Me.Button5.Text = "<"
        '
        'Button6
        '
        Me.Button6.Location = New System.Drawing.Point(392, 216)
        Me.Button6.Name = "Button6"
        Me.Button6.Size = New System.Drawing.Size(48, 23)
        Me.Button6.TabIndex = 21
        Me.Button6.Text = ">"
        '
        'Button7
        '
        Me.Button7.Location = New System.Drawing.Point(440, 216)
        Me.Button7.Name = "Button7"
        Me.Button7.Size = New System.Drawing.Size(48, 23)
        Me.Button7.TabIndex = 22
        Me.Button7.Text = ">>"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(496, 421)
        Me.Controls.Add(Me.Button7)
        Me.Controls.Add(Me.Button6)
        Me.Controls.Add(Me.Button5)
        Me.Controls.Add(Me.Button4)
        Me.Controls.Add(Me.Button3)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.TextBox8)
        Me.Controls.Add(Me.Label8)
        Me.Controls.Add(Me.TextBox7)
        Me.Controls.Add(Me.Label7)
        Me.Controls.Add(Me.Label6)
        Me.Controls.Add(Me.TextBox6)
        Me.Controls.Add(Me.TextBox5)
        Me.Controls.Add(Me.TextBox4)
        Me.Controls.Add(Me.TextBox3)
        Me.Controls.Add(Me.TextBox2)
        Me.Controls.Add(Me.TextBox1)
        Me.Controls.Add(Me.Label5)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Name = "Form1"
        Me.Text = "Form1"
        CType(Me.DataSet11, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i, cveDr, eda As Integer
        Dim nomb, apat, telef, direc, carqreal, ttrab As String
        Dim rw As DataRow

        rw = DataSet11.Tables(0).NewRow

        cveDr = InputBox("Cve_Doctor")
        nomb = InputBox("Nombre")
        apat = InputBox("Apellido_Paterno")
        eda = InputBox("Edad")
        telef = InputBox("Telefono")
        direc = InputBox("Direccion")
        carqreal = InputBox("Cargo_q_Realiza")
        ttrab = InputBox("Tiempo_trabajando")

        rw.Item("Cve_Doctor") = cveDr
        rw.Item("Nombre") = nomb
        rw.Item("Apellido_Paterno") = apat
        rw.Item("Edad") = eda
        rw.Item("Telefono") = telef
        rw.Item("Direccion") = direc
        rw.Item("Cargo_q_Realiza") = carqreal
        rw.Item("Tiempo_trabajando") = ttrab

        Try
            DataSet11.Tables(0).Rows.Add(rw)
            i = SqlDataAdapter1.Update(DataSet11)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim i, rwno As Integer
        Dim colname As String
        Dim value As Object
        colname = InputBox("Nombre de la Columna")
        rwno = InputBox("Numero de registro")
        value = InputBox("Nuevo valor")
        Try
            DataSet11.Tables(0).Rows(rwno).Item(colname) = value
            i = SqlDataAdapter1.Update(DataSet11)
        Catch ex As Exception
            MessageBox.Show(ex.Message)

        End Try
        MessageBox.Show("Numero de registros actualizados" & i)

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim i, rwno As Integer
        Dim colname As String
        Dim value As Object
        colname = InputBox("Nombre de la Columna")
        rwno = InputBox("Numero de registro")
        value = InputBox("Nuevo valor")
        Try
            DataSet11.Tables(0).Rows(rwno).Item(colname) = value
            i = SqlDataAdapter1.Update(DataSet11)
        Catch ex As Exception
            MessageBox.Show(ex.Message)

        End Try
        MessageBox.Show("Numero de registros actualizados" & i)

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        SqlDataAdapter1.Fill(DataSet11)
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Me.BindingContext(DataSet11, "Doctores").Position = 0
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Me.BindingContext(DataSet11, "Doctores").Position = (Me.BindingContext(DataSet11, "Doctores").Position - 1)
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Me.BindingContext(DataSet11, "Doctores").Position = (Me.BindingContext(DataSet11, "Doctores").Position + 1)
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        Me.BindingContext(DataSet11, "Doctores").Position = (Me.DataSet11.Tables("Doctores").Rows.Count - 1)
    End Sub
End Class