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

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

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

    Next


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.

oh thank you! it solves my problem :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.