Click here to Skip to main content
15,924,581 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralAn unhandled exception occured when i drop control on win form and run it Pin
imran.arshad6-Apr-05 20:51
imran.arshad6-Apr-05 20:51 
Generalhelp connecting to sql server ce using vb.net Pin
gundamhamtaro6-Apr-05 20:43
gundamhamtaro6-Apr-05 20:43 
GeneralRe: help connecting to sql server ce using vb.net Pin
Dave Kreskowiak7-Apr-05 4:23
mveDave Kreskowiak7-Apr-05 4:23 
GeneralRe: help connecting to sql server ce using vb.net Pin
gundamhamtaro7-Apr-05 16:31
gundamhamtaro7-Apr-05 16:31 
GeneralIm trying to return a datatable when using OleDbCommand Pin
Anonymous6-Apr-05 13:08
Anonymous6-Apr-05 13:08 
GeneralRe: Im trying to return a datatable when using OleDbCommand Pin
Christian Graus6-Apr-05 14:16
protectorChristian Graus6-Apr-05 14:16 
GeneralRe: Im trying to return a datatable when using OleDbCommand Pin
Martin@captivasystems7-Apr-05 2:57
Martin@captivasystems7-Apr-05 2:57 
GeneralRe: Im trying to return a datatable when using OleDbCommand Pin
j1webb7-Apr-05 11:10
j1webb7-Apr-05 11:10 
You can try this code to use your datareader to build your datatable

Dim table As New DataTable()
Dim row As DataRow
Dim rows As DataRowCollection

' read table schema from datareader
rows = DataReader.GetSchemaTable.Rows
'If you already know your field names you can use this
table.Clear()
table.Columns.Clear()
' Define the columns.
table.Columns.Add("Last Name", GetType(String))
table.Columns.Add("First Name", GetType(String))
table.Columns.Add("Phone Number", GetType(String))
table.Columns.Add("Email Address", GetType(String))


'Other wise do this
' use schema to create the columns for the new datatable
For Each row In rows
Dim col As New DataColumn()
col.ColumnName = row("ColumnName").ToString
col.Unique = System.Convert.ToBoolean(row("IsUnique"))
col.AllowDBNull = System.Convert.ToBoolean(row("AllowDBNull"))
col.ReadOnly = System.Convert.ToBoolean(row("IsReadOnly"))
col.DataType = Type.GetType(row("DataType").ToString)
table.Columns.Add(col)
Next

While DataReader.Read
row = table.NewRow
Dim col As DataColumn
For Each col In table.Columns
row(col) = DataReader(col.ColumnName)
Next
table.Rows.Add(row)
End While
Return table

Please let me know if this helped you.


GeneralRe: Im trying to return a datatable when using OleDbCommand Pin
j1webb7-Apr-05 12:11
j1webb7-Apr-05 12:11 
GeneralRe: Im trying to return a datatable when using OleDbCommand Pin
j1webb7-Apr-05 12:16
j1webb7-Apr-05 12:16 
GeneralRe: Im trying to return a datatable when using OleDbCommand Pin
Martin@captivasystems7-Apr-05 14:12
Martin@captivasystems7-Apr-05 14:12 
GeneralProblem in Clearing Items of the Combo Box Pin
alizai6-Apr-05 10:02
alizai6-Apr-05 10:02 
GeneralRe: Problem in Clearing Items of the Combo Box Pin
Mandar Patankar6-Apr-05 10:53
Mandar Patankar6-Apr-05 10:53 
GeneralRe: Problem in Clearing Items of the Combo Box Pin
alizai6-Apr-05 11:18
alizai6-Apr-05 11:18 
GeneralRe: Problem in Clearing Items of the Combo Box Pin
Dave Kreskowiak6-Apr-05 13:34
mveDave Kreskowiak6-Apr-05 13:34 
GeneralRe: Problem in Clearing Items of the Combo Box Pin
Anonymous7-Apr-05 21:44
Anonymous7-Apr-05 21:44 
GeneralFormatting numbers in a datagrid Pin
j1webb6-Apr-05 6:29
j1webb6-Apr-05 6:29 
GeneralRe: Formatting numbers in a datagrid Pin
Dave Kreskowiak7-Apr-05 4:41
mveDave Kreskowiak7-Apr-05 4:41 
GeneralRe: Formatting numbers in a datagrid Pin
j1webb7-Apr-05 10:28
j1webb7-Apr-05 10:28 
GeneralOptimisation Model Solution Routine(Linear Programming) Pin
karmond6-Apr-05 6:00
karmond6-Apr-05 6:00 
GeneralRe: Optimisation Model Solution Routine(Linear Programming) Pin
Dave Kreskowiak7-Apr-05 4:10
mveDave Kreskowiak7-Apr-05 4:10 
GeneralDatagrid Exporting to Excel Format Pin
Scttsmpsn6-Apr-05 4:53
Scttsmpsn6-Apr-05 4:53 
GeneralRe: Datagrid Exporting to Excel Format Pin
Scttsmpsn6-Apr-05 8:25
Scttsmpsn6-Apr-05 8:25 
QuestionSwitching language programmatically ? Pin
kil0byte^bandit6-Apr-05 4:30
kil0byte^bandit6-Apr-05 4:30 
GeneralMachine.Config Pin
Jason Weibel6-Apr-05 4:25
Jason Weibel6-Apr-05 4:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.