-
October 14th, 2013, 02:39 PM
#1
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.
-
October 16th, 2013, 08:04 AM
#2
Re: DataColumn's AutoIncrement Returns False Always
Shouldn't you dispose of your data adapter after your loop, instead of above it?
-
October 16th, 2013, 03:37 PM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|