CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2009
    Posts
    9

    DataColumn's AutoIncrement Returns False Always

    Hey all,

    I am interested to check out whether column has an autoincrement/allowdbnull property .

    Having this code below , gives me always false although I already have one column that has autoincrement/allowdbnull property.


    Code:
     Dim dt As New DataTable()
        Dim con As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source =" & Application.StartupPath & "\test.mdb"
        Dim sql As String = "SELECT * from teachers"
        Dim i As Integer
    
            Dim dataAdapter As New OleDb.OleDbDataAdapter(sql, con)
            dataAdapter.Fill(dt)
            dataAdapter.Dispose()
    
      For Each column As DataColumn In dt.Columns
    TextBox1.Text = TextBox1.Text & column.ColumnName & "      " & column.AutoIncrement & "    " & column.AllowDBNull & vbCrLf
     Next
    thanks.

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: DataColumn's AutoIncrement Returns False Always

    Shouldn't you dispose of your data adapter after your loop, instead of above it?

  3. #3
    Join Date
    Oct 2009
    Posts
    9

    Re: DataColumn's AutoIncrement Returns False Always

    I assume the answer is No , because dataAdapter came to fill the DataTable , once Databale is filled there is no need for the dataAdapter and I can release it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured