Public Function gettable (ByVal _reader as System.Data.SqlClient.SqlDataReader) as System.Data.DataTable
On Error Resume Next
Dim _table as System.Data.DataTable = _reader. GetSchemaTable ()
Dim _dt as System.Data.DataTable = New System.Data.DataTable ()
Dim _DC as System.Data.DataColumn
Dim _row as System.Data.DataRow
Dim _al as System.Collections.ArrayList = New System.Collections.ArrayList ()
Dim i = 0
For i = 0 to _table. Rows.Count ()-1
_DC = New System.Data.DataColumn ()
If (not _dt. Columns.contains (_table. Rows (i) ("ColumnName"). ToString ()) Then
_dc. ColumnName = _table. Rows (i) ("ColumnName"). ToString ()
_dc. Unique = Convert.toboolean (_table. Rows (i) ("IsUnique"))
_dc. AllowDBNull = Convert.toboolean (_table. Rows (i) ("AllowDBNull"))
_dc. ReadOnly = Convert.toboolean (_table. Rows (i) ("IsReadOnly"))
_dc. ReadOnly = Convert.toboolean (_table. Rows (i) ("IsReadOnly"))
_dc. ReadOnly = Convert.toboolean (_table. Rows (i) ("IsReadOnly"))
_dc. ReadOnly = Convert.toboolean (_table. Rows (i) ("IsReadOnly"))
_al. ADD (_DC. ColumnName)
_dt. Columns.Add (_DC)
End If
Next
While _reader. Read ()
_row = _dt. NewRow ()
For i = 0 to _al. Count
_row (CStr (_al (i)) = _reader (CStr (_al (i)))
Next
_dt. Rows.Add (_row)
End While
Return _DT
End Function
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.