Que tal Disculpen por la ignorancia estoy haciendo una peque base de datos en vb 2005 y sql ya tengo el boton guardar pero ya no se como hacer el modificar y el eliminar y el buscar registro,sera que alguien me puede ayudar de como hacerlo. desde agradezco sus comentarios. este es el codigo que estoy usando
Imports System.Data.SqlClient
PublicClass Form1
Private oConexion As SqlConnection
Private oDataSet As DataSet
Private oDapter As SqlDataAdapter
PrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
oConexion = New SqlConnection
oConexion.ConnectionString = "server=(local)\SQLEXPRESS;" & _
"integrated security=sspi;" & _
"database=Prueva"
oDapter = New SqlDataAdapter
Dim oComandInsercion AsNew SqlCommand("INSERT INTO Personal " & _
"(Codigo,Nombre,Apellido) VALUES(@Codigo,@Nombre,@Apellido)", oConexion)
oDapter.InsertCommand = oComandInsercion
oDapter.InsertCommand.Parameters.Add(New SqlParameter("@Codigo", SqlDbType.Int))
oDapter.InsertCommand.Parameters.Add(New SqlParameter("@Nombre", SqlDbType.VarChar))
oDapter.InsertCommand.Parameters.Add(New SqlParameter("@Apellido", SqlDbType.VarChar))
Dim oCmdCon AsNew SqlCommand("SELECT * FROM Personal", oConexion)
oDapter.SelectCommand = oCmdCon
oDataSet = New DataSet
Me.CargarDatos()
EndSub
PrivateSub CargarDatos()
oDataSet.Clear()
oConexion.Open()
oDapter.Fill(oDataSet, "Personal")
oConexion.Close()
Me.DataGridView1.DataSource = oDataSet
Me.DataGridView1.DataMember = "Personal"
EndSub
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim iResultado AsInteger
oDapter.InsertCommand.Parameters("@Codigo").Value = Me.TextBox1.Text
oDapter.InsertCommand.Parameters("@Nombre").Value = Me.TextBox2.Text
oDapter.InsertCommand.Parameters("@Apellido").Value = Me.TextBox3.Text
oConexion.Open()
iResultado = oDapter.InsertCommand.ExecuteNonQuery()
oConexion.Close()
Me.CargarDatos()
MessageBox.Show("El Registro a sido Guardado" & iResultado)
oConexion.Close()
EndSub
EndClass