Click here to Skip to main content
15,900,725 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to know how can I show records in datagridview by using adodb?

I have used mshflexgrid & it workded well but when I try to build my program it shows error that "AxMSHierarchicalFlexGridLib.AxMSHFlexGrid' is not defined".

I am going to share my code what I have written for mshflexgrid to show record. Please check it & tell me what should I do or write to show record in datagridview by using adodb or if I use mshflexgrid how can I get rid of that error when I will build my program.
My code:
VB
Private Sub Form34_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

con = New ADODB.Connection

con.Open("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=SUIMT")

End Sub

Private Sub cmbdmidt_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbdmidt.Leave
    On Error Resume Next
    rst = New ADODB.Recordset
    With rst
        .Open("Select row_num, stu_id, tot_amou, paid, du, aoins, due, dt From monthly_instal where stu_id = '" & cmbdmiidn.Text & "' AND dt = '" & cmbdmidt.Text & "'", con, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
        
        Mshgrid2.DataSource = rst

        Mshgrid2.set_TextMatrix(0, 0, "ROW NUMBER")

        Mshgrid2.set_TextMatrix(0, 1, "ID NUMBER")

        Mshgrid2.set_TextMatrix(0, 2, "TOTAL AMOUNT")

        Mshgrid2.set_TextMatrix(0, 3, "PAID")

        Mshgrid2.set_TextMatrix(0, 4, "DUE")

        Mshgrid2.set_TextMatrix(0, 5, "AMOUNT OF INSTALLMENT")

        Mshgrid2.set_TextMatrix(0, 6, "DUE")

        Mshgrid2.set_TextMatrix(0, 7, "DATE")

        Mshgrid2.set_ColWidth(0, 2500)
        Mshgrid2.set_ColWidth(1, 2500)
        Mshgrid2.set_ColWidth(2, 2500)
        Mshgrid2.set_ColWidth(3, 2500)
        Mshgrid2.set_ColWidth(4, 2500)
        Mshgrid2.set_ColWidth(5, 2500)
        Mshgrid2.set_ColWidth(6, 2500)
        Mshgrid2.set_ColWidth(7, 2500)
        .Close()
    End With
End Sub
Posted
Updated 14-Sep-10 6:31am
v2

1 solution

I would guess that you've lost the reference to AxMSHierarchicalFlexGridLib. And I assume that the error happens when your form opens. Put a breakpoint at con = New Adodb.Connection and see if it even hits that breakpoint.

I would guess you've moved the dll where you got the mshFlexGrid, or opened your project on a different computer that doesn't have that dll.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900