How do you insert label values to database? here is my code..
Imports System.Data.OleDb
Public Class frmemp
Dim con As New OleDbConnection
Dim dbAddNew As New OleDbCommand()
Private Sub frmemp_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ds As New DataSet
Dim dt As New DataTable
Dim da As New OleDbDataAdapter
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\myDB.mdb"
con.Open()
ds.Tables.Add(dt)
da = New OleDbDataAdapter("Select * From INFO_TABLE WHERE USER_ID LIKE '" & txtUSERID.Text & "'", con)
da.Fill(dt)
DataGridView1.DataSource = dt.DefaultView
Dim y As Integer = Val(DataGridView1.CurrentRow.Index)
lblfn.Text = DataGridView1.Item(2, y).Value
lblpro.Text = DataGridView1.Item(3, y).Value
lblsa.Text = DataGridView1.Item(4, y).Value
con.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
lblTimeOut.Text = Format(System.DateTime.Now, "MM/dd/yyyy hh:mm:ss tt")
Dim result As Integer
result = MessageBox.Show("Are you sure you want to logout?", "ASC Billing System", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1)
If result = vbYes Then
Me.Close()
frmlogin.Show()
frmlogin.UsernameTextBox.Clear()
frmlogin.PasswordTextBox.Clear()
frmlogin.Show()
Else
Me.Show()
End If
End Sub
End Class
here is the window - http://postimage.org/image/311bhg2mc/
I need to insert lblTimeIn,lblTimeOut, and lblfn values to my database which is myDB after the Logout/Button1 is clicked..
How do you do this? I really dont have any knowledge about insert values in sql..
Please help..thanks..