0

when done with the form it will come out antother that is this form in the listbox1 should show out dun need click anthing it will come out auto of the admin No why dose not show out

Public Class DataOfProject

Private Sub ListBoxassign_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBoxassign.SelectedIndexChanged

    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 * From tbl_info where AdminNo"

    Dim sqlCom As New System.Data.OleDb.OleDbCommand(sql, conn)
    sqlCom.Connection = conn

    Dim sqlReader As System.Data.OleDb.OleDbDataReader = sqlCom.ExecuteReader

    While sqlReader.Read = True

        ListBoxassign.Items.Add(sqlReader.Item("AdminNo").ToString)



    End While
    sqlReader.Close()
    sqlCom.Dispose()
    conn.Close()

    Student_Form.Show()


End Sub

Edited by pritaeas: Moved to VB

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

check Database1.accdb if it has a security for log in.
if it requires for a user and password.
merge it into your connectionstring

0

yes when i login it go in it connection but only the listbox dose to show out

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.