Re: Get schema?
- From: "Kerry Moorman" <KerryMoorman@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 13 Jul 2005 19:59:09 -0700
Ben,
Here is an example that displays all the column names. You can modify it to
create a comma-separated list:
Private Sub DisplayColumns(ByVal ConnectionString As String, ByVal
TableName As String)
Dim cn As New OleDb.OleDbConnection(ConnectionString)
Dim cmd As New OleDb.OleDbCommand
Dim rdr As OleDb.OleDbDataReader
Dim tbl As DataTable
cmd.CommandText = "Select * From " & TableName
cn.Open()
cmd.Connection = cn
rdr = cmd.ExecuteReader(CommandBehavior.SchemaOnly Or
CommandBehavior.KeyInfo)
tbl = rdr.GetSchemaTable
rdr.Close()
Dim row As DataRow
For Each row In tbl.Rows
MsgBox(row("ColumnName"))
Next
End Sub
Kerry Moorman
"Ben Wallace (3)" wrote:
> Thanks, for the replys. My main goal is to contruct an SQL statement baseD
> on the schema, using the fields IN an UPDATE statement, how can I get the
> field names from the schema table, and creat a comma seperated list
> (field1,field2,field3 ....etc...), a loop possibly?
>
> Thanks
>
>
>
>
>
> "Russell Verdun" <cpa44@xxxxxxxxxxx> wrote in message
> news:%23pkHPFAiFHA.572@xxxxxxxxxxxxxxxxxxxxxxx
> >I hope someone can advise on a solution....how can I obtain schema
> > information, column names to be exact, from a SQL, Oracle table via
> > ado.net.
> > I need to gather the column names from a given table.
> >
> > Thank you.
> >
> >
> >
> >
>
>
>
.
- References:
- Get schema?
- From: Russell Verdun
- Re: Get schema?
- From: Ben Wallace \(3\)
- Get schema?
- Prev by Date: Re: Get schema?
- Next by Date: Re: Deleting datacolumns
- Previous by thread: Re: Get schema?
- Next by thread: Re: Get schema?
- Index(es):
Relevant Pages
|