i dont know what to do with this codes. when i used this to other forms it runs without error except for the one form. error says : "The ConnectionString property has not been initialized." but then i already initialized it. please help me.

   Public Sub showmyrecords()
    Dim lvi As ListViewItem
    Dim dt As New DataTable
    Dim ds As New DataSet
    ' Dim intCount As Integer

    Dim da As New OleDbDataAdapter("Select * from Schedulings where YearLevels = '" & TextBox3.Text & "' and Sections = '" & TextBox4.Text & "'", asconn)

    Dim acscmd As New OleDb.OleDbCommand
    acscmd.CommandText = strsql
    acscmd.Connection = asconn
    For Each myrow__1 As DataRow In dt.Rows
        lvi = New ListViewItem()
        lvi.Text = myrow__1(5)
        '6 is 7th column in datatable!!!
        'and so on...
        lvi.SubItems.Add(myrow__1(8) + "-" + myrow__1(9))


End Sub

I have faced this kind of problems in vb6, then i used to close conection on closing each form and used to open on other forms load event. I dont know whether this will help u or not but thats how i solved my problem.

This question has already been answered. Start a new discussion instead.