How to Get Description of Column_Flags by function GetSchema

Mansour_Dalir 2,036 Reputation points
2024-04-15T17:21:22.44+00:00

User's image

hi . What are these numbers and how can they be translated?

   Dim cn As New OleDb.OleDbConnection(Conn_String_Access)
        cn.Open()
        Dim dtSheama As New DataTable
        dtSheama = cn.GetSchema("Tables") 'indexes'columns'Tables
Developer technologies | VB
SQL Server | Other
0 comments No comments
{count} votes

Accepted answer
  1. Jiachen Li-MSFT 34,221 Reputation points Microsoft External Staff
    2024-04-16T02:34:25.9433333+00:00

    Hi @Mansour_Dalir ,

    For details about the meaning of Column_Flags values, see DBSCHEMA_COLUMNS.

            Using connection As New SqlConnection(connectionString)
                connection.Open()
    
                Dim tableSchema As DataTable = connection.GetSchema("Columns", New String() {Nothing, Nothing, tableName})
    
                For Each row As DataRow In tableSchema.Rows
                    Dim columnName As String = row("COLUMN_NAME").ToString()
                    Dim columnFlags As Integer = Convert.ToInt32(row("COLUMN_FLAGS"))
    
                    Console.WriteLine($"Column Name: {columnName}, Column Flags: {columnFlags}")
                Next
            End Using
    
    

    Best Regards.

    Jiachen Li


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.