Código PHP:
Imports MySql.Data.MySqlClient
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Myconnection As MySqlConnection = New MySqlConnection()
Dim Mycommand As New MySqlCommand
Dim oData As MySqlDataReader
On Error GoTo 0
Myconnection.ConnectionString = "server=*****;database=****;Uid=****;Pwd=***"
Myconnection.Open()
MsgBox("conexion abierta")
End Sub
End Class
Código PHP:
Imports System.Data.OleDb
Public Class Form1
Dim N As Integer = 0
Dim CN As New OleDb.OleDbConnection("PROVIDER=MICROSOFT.ACE.OLEDB.12.0;DATA SOURCE=D:\BASEDATA.accdb")
'CREAREMOS UN PROCEDIMIENTO PARA MOSTRAR LA TABLA
Sub MOSTRAR()
Dim DA As New OleDb.OleDbDataAdapter("SELECT * FROM TRABAJADOR", CN)
Dim DS As New DataSet
DA.Fill(DS, "TRABAJADOR")
DataGridView1.DataSource = DS.Tables("TRABAJADOR")
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'AL MOMENTO Q CARGE EL FORM1 MUESTRE...
MOSTRAR()
CARGAR()
BLOQUEAR()
CARGAR_CBO()
End Sub
Sub CARGAR()
Dim DA As New OleDb.OleDbDataAdapter("SELECT * FROM TRABAJADOR", CN)
Dim DS As New DataSet
DA.Fill(DS, "TRABAJADOR")
CBOCOD.DataSource = DS.Tables("TRABAJADOR")
CBOCOD.DisplayMember = "COD"
End Sub
Sub CARGAR_CBO()
CBOCARGO.Items.Add("ADMINISTRADOR")
CBOCARGO.Items.Add("SUPERVISOR")
CBOCARGO.Items.Add("CONTADOR")
CBOCARGO.Items.Add("ASISTENTE")
CBOCARGO.Items.Add("PROGRAMADOR")
CBOTURNO.Items.Add("MAÑANA")
CBOTURNO.Items.Add("NOCHE")
CBOTURNO.Items.Add("TARDE")
End Sub
Sub LIMPIAR()
TXTAPE.Clear()
TXTDNI.Clear()
TXTNOM.Clear()
TXTSUELDO.Clear()
TXTTELF.Clear()
CBOCARGO.Text = ""
CBOCOD.Text = ""
CBOTURNO.Text = ""
End Sub
Sub BLOQUEAR()
BTNBUSCAR.Enabled = True
BTNNEW.Enabled = True
BTNGUARDAR.Enabled = False
BTNMODIFIC.Enabled = True
BTNELIMIN.Enabled = True
BTNCANCELAR.Enabled = False
End Sub
Sub DEBLOQUEAR()
BTNBUSCAR.Enabled = False
BTNNEW.Enabled = False
BTNGUARDAR.Enabled = True
BTNMODIFIC.Enabled = False
BTNELIMIN.Enabled = False
BTNCANCELAR.Enabled = True
End Sub
Sub BUSCAR_COD()
Dim CMD As New OleDb.OleDbCommand("SELECT * FROM TRABAJADOR WHERE COD='" & CBOCOD.Text & "'", CN)
Dim DR As OleDb.OleDbDataReader
CN.Open()
DR = CMD.ExecuteReader
If DR.Read Then
TXTDNI.Text = DR(1)
TXTNOM.Text = DR(2)
TXTAPE.Text = DR(3)
CBOCARGO.Text = DR(4)
CBOTURNO.Text = DR(5)
TXTSUELDO.Text = DR(6)
TXTTELF.Text = DR(7)
Else
MsgBox("ERROR")
End If
CN.Close()
End Sub
Sub NUEVO()
Dim CMD As New OleDb.OleDbCommand("INSERT INTO TRABAJADOR VALUES('" & CBOCOD.Text & "','" & TXTDNI.Text & "','" & TXTNOM.Text & "','" & TXTAPE.Text & "','" & CBOCARGO.Text & "','" & CBOTURNO.Text & "','" & TXTSUELDO.Text & "','" & TXTTELF.Text & "')", CN)
CN.Open()
CMD.ExecuteNonQuery()
CN.Close()
MOSTRAR()
MsgBox("REGISTRO AGREGADO")
End Sub
Sub MODIFICAR()
Dim CMD As New OleDb.OleDbCommand("UPDATE TRABAJADOR SET COD='" & CBOCOD.Text & "',DNI='" & TXTDNI.Text & "',NOM='" & TXTNOM.Text & "',APE='" & TXTAPE.Text & "',CARGO='" & CBOCARGO.Text & "',TURNO='" & CBOTURNO.Text & "',SUELDO='" & TXTSUELDO.Text & "',TELF='" & TXTTELF.Text & "' WHERE COD='" & CBOCOD.Text & "'", CN)
CN.Open()
CMD.ExecuteNonQuery()
CN.Close()
MOSTRAR()
MsgBox("REGISTRO ACTUALIZADO")
End Sub
Private Sub BTNBUSCAR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNBUSCAR.Click
BUSCAR_COD()
End Sub
Private Sub BTNNEW_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNNEW.Click
DEBLOQUEAR()
LIMPIAR()
N = 1
End Sub
Private Sub BTNMODIFIC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNMODIFIC.Click
DEBLOQUEAR()
N = 2
End Sub
Private Sub BTNGUARDAR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNGUARDAR.Click
If N = 1 Then
NUEVO()
ElseIf N = 2 Then
MODIFICAR()
End If
BLOQUEAR()
LIMPIAR()
CARGAR()
N = 0
End Sub
Private Sub BTNCANCELAR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNCANCELAR.Click
BLOQUEAR()
LIMPIAR()
N = 0
End Sub
Private Sub BTNELIMIN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNELIMIN.Click
Dim CMD As New OleDb.OleDbCommand("DELETE FROM TRABAJADOR WHERE COD='" & CBOCOD.Text & "'", CN)
CN.Open()
CMD.ExecuteNonQuery()
CN.Close()
LIMPIAR()
CARGAR()
MOSTRAR()
MsgBox("EL REGISTRO SE A ELIMINADO")
End Sub
End Class
quisiera que me puedan ayudar ya tengo 2 dias enteros investigando sobre esto y mi unica esperanza es esta web .