0

is this coorrct if write like this:

Public Class Lecturer_Form

Private Sub Lecturer_Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim conn As New System.Data.OleDb.OleDbConnection()
    conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\temp\Database1.accdb"


    If conn.State = ConnectionState.Open Then conn.Close()
    conn.Open()
    Dim sql As String = "Select A.StaffNo,A.TimeIn,A.TimeOut, B.ProjectNo, C.AdminNo, C.UserName From tbl_lecturer A, tbl_assignment B, tbl_info C,= '" & TextBoxname.Text & "', '" & Textin.Text & "','" & Textout.Text & "'"
    Dim sqlCom As New System.Data.OleDb.OleDbCommand(sql, conn)
    sqlCom.Connection = conn
    Dim sqlReader As System.Data.OleDb.OleDbDataReader = sqlCom.ExecuteReader()

    If sqlReader.HasRows Then
        While (sqlReader.Read)
            ComboBoxstaff.Items.Add(sqlReader.Item("StaffNo").ToString)
            ComboBoxpro.Items.Add(sqlReader.Item("ProjectNo").ToString)
            ComboBoxadm.Items.Add(sqlReader.Item("AdminNo").ToString)
            TextBoxname.Text = (sqlReader.Item("UserName").ToString)
            Textin.Text = (sqlReader.Item("TimeIn").ToString)
            Textout.Text = (sqlReader.Item("TimeOut").ToString)
            LBtimeIN.Items.Add(sqlReader.Item("TimeIN").ToString)
            LBtimeIN.Items.Add(sqlReader.Item("TimeOut").ToString)
        End While
    End If
End Sub

End Class

Edited by Xiao_1

2
Contributors
6
Replies
16
Views
2 Years
Discussion Span
Last Post by Xiao_1
0

Dim sql As String = "Select A.StaffNo,A.TimeIn,A.TimeOut, B.ProjectNo, C.AdminNo, C.UserName From tbl_lecturer A, tbl_assignment B, tbl_info C,= '" & TextBoxname.Text & "', '" & Textin.Text & "','" & Textout.Text & "'"

Do not understand the SQL Statement. What do you want?

0

after i choose the 3 combobox and in the tbl_info of the user name come out at textbox and tbl_lecturer time in and out in the textin, textout and the listboxin, listboxout time in and out..!

Edited by Xiao_1

0

Your SQL Statement is wrong in the position of condition checking.
What are the relationships between these three tables?

0

these three table is when student register in it will come a form staff no project no and admin atfer chosse them in the below which of a stuednt have the project and which date have also what time they come in what time they go out

0

Describe the relation between these three tables in details or post the tablenames and their fieldnames.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.