0
Private Sub submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles submit.Click
    Dim con As New OleDb.OleDbConnection
    Dim cmd As New OleDb.OleDbCommand
    Dim dbProvider As String = "PROVIDER = Microsoft.Jet.OleDb.4.0;"
    Dim dbSource As String = "DATA SOURCE =" & Application.StartupPath & "\hospital.mdb"
    con.ConnectionString = dbProvider & dbSource
    If Not con.State = ConnectionState.Open Then
        con.Open()
    End If
    cmd.Connection = con
    cmd.CommandText = "INSERT INTO userdata(masterid, pname, aname, dob, bloodgroup, address, gender, referto, designation, relh, mpass, ward, bed, zone)" & _
    "VALUES ('" & Me.masterid.Text & "','" & Me.pname.Text & "','" & Me.aname.Text & "','" & Me.dob.Text & "','" & Me.bloodgroup.Text & "','" & _
    Me.address.Text & "','" & Me.gender.Text & "','" & Me.referto.Text & "','" & Me.designation.Text & "','" & Me.relh.Text & "','" & Me.mpass.Text & "','" & _
    Me.ward.Text & "','" & Me.bed.Text & "','" & Me.zone.Text & "')"
    cmd.ExecuteNonQuery()

    con.Close()
End Sub

そして、cmd.Commandtext に入る値は

"INSERT INTO userdata(masterid, pname, aname, [dob], bloodgroup, address, gender, referto, designation, relh, mpass, ward, bed, zone)VALUES ('305201323114','fsdfsd','sdfsd','5/29/2013','AB+','sdfsd','Male','sdfsd','sdfsd','sdfsd','sdfdsf','sdfsdf','dfds','North East Zone')"
4

1 に答える 1