i recently posted a code that i had that i needed assistance for and it was solved it was for displaying all tables in a database.but now i have this code for showing all column names in a table i was in the process of turning it from oledb to sqlclient.And now iam stuck can onyone help?GetOLedbSchema can be turned to getschema but when it comes to OleDbSchemaGuid i do not know i would appreciate any help

Public Shared Function getAllColumnNames(ByVal tblname As String) As String()
        Dim com As New SqlCommand
        Dim con As SqlConnection
        Dim str1() As String
        Dim dtable1 As DataTable
        con = New SqlConnection("server=..;uid=..;pwd=..;database=..")
        con.Open()
        com.Connection = con
        dtable1 = con.GetoledbSchema(OleDb.OleDbSchemaGuid.Columns, New Object() {Nothing, Nothing, tblname, Nothing})
        For i = 0 To dtable1.Rows.Count - 1
            ReDim Preserve str1(i)
            str1(i) = dtable1.Rows(i).Item(3).ToString
        Next i
        'HELP
        'Item collection 0- "TABLE_CATALOG"
        'Item collection 1-"TABLE_SCHEMA"
        'Item collection 2-"TABLE_NAME"
        'Item collection 3-"COLUMN_NAME"
        Return str1
    End Function
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.