M
Mythran
Sorry bout the xpost, was told to post here instead
---------------------------------------------------
Consider the following code, test and try it out:
Dim Conn As OdbcConnection
Dim Reader As OdbcDataReader
Dim Cmd As OdbcCommand
Dim Adapter As OdbcDataAdapter
Dim Table As System.Data.DataTable
'
' Create all of the objects to use.
Conn = New OdbcConnection()
Cmd = New OdbcCommand()
Adapter = New OdbcDataAdapter()
Data = New System.Data.DataSet()
'
' The connection object.
Conn.ConnectionString = "DSN=dbTest"
Conn.Open()
'
' The command object.
Cmd.Connection = Conn
Cmd.CommandType = CommandType.Text
Cmd.CommandText = "SELECT * FROM [Test]"
'
' Get the table's schema.
Reader = Cmd.ExecuteReader(CommandBehavior.SchemaOnly)
Table = Reader.GetSchemaTable()
Reader.Close()
'
' Set the data source for the data grid.
dgInfo.DataSource = Table
'
' Close and destroy all of the data access objects.
Conn.Close()
Table = Nothing
Reader = Nothing
Cmd = Nothing
Conn = Nothing
Now, what I have done is set up a few columns in this microsoft access database.
These columns are mapped as follows:
AutoNumberfield - AutoNumber - Primary key has been set on this field.
Textfield - Text
Memofield - Memo
Numberfield - Number
DateTimefield - Date/Time
Currencyfield - Currency
YesNofield - Yes/No
OLEObjectfield - OLE Object
Hyperlinkfield - Hyperlink
Decimalfield - Number - Field Size property set to Byte.
Now, when the code above runs on this table, the schema returned is not complete
or invalid altogether (maybe just incomplete).
The AutoNumberfield column should show in the IsKey property as True (or checked)
but it doesn't. I noticed this problem or SQL Server primary key's as well, the
primary keys are not checked in IsKey at all! How can I determine if the
specified field is or is part of the primary key for the specified table?
The Hyperlinkfield returns the exact same information as the memo field. How can
I tell these apart? I have checked the ExtendedProperties property while
running some tests using a data adapter and dataset but the extendedproperties
are NEVER set so I can't query those to find out.
The Decimalfield and Currencyfield both return the same datatype (Numeric) and
the Numberfield returns the property datatype (Integer). But notice that the
Decimalfield is in fact a Number while the field size has been set to Byte (or
decimal). Why does this return Number? How can I tell these two apart (Number
with Field Size set to something)?
Ok, enough questions already
Thanks in advance...
Mythran
---------------------------------------------------
Consider the following code, test and try it out:
Dim Conn As OdbcConnection
Dim Reader As OdbcDataReader
Dim Cmd As OdbcCommand
Dim Adapter As OdbcDataAdapter
Dim Table As System.Data.DataTable
'
' Create all of the objects to use.
Conn = New OdbcConnection()
Cmd = New OdbcCommand()
Adapter = New OdbcDataAdapter()
Data = New System.Data.DataSet()
'
' The connection object.
Conn.ConnectionString = "DSN=dbTest"
Conn.Open()
'
' The command object.
Cmd.Connection = Conn
Cmd.CommandType = CommandType.Text
Cmd.CommandText = "SELECT * FROM [Test]"
'
' Get the table's schema.
Reader = Cmd.ExecuteReader(CommandBehavior.SchemaOnly)
Table = Reader.GetSchemaTable()
Reader.Close()
'
' Set the data source for the data grid.
dgInfo.DataSource = Table
'
' Close and destroy all of the data access objects.
Conn.Close()
Table = Nothing
Reader = Nothing
Cmd = Nothing
Conn = Nothing
Now, what I have done is set up a few columns in this microsoft access database.
These columns are mapped as follows:
AutoNumberfield - AutoNumber - Primary key has been set on this field.
Textfield - Text
Memofield - Memo
Numberfield - Number
DateTimefield - Date/Time
Currencyfield - Currency
YesNofield - Yes/No
OLEObjectfield - OLE Object
Hyperlinkfield - Hyperlink
Decimalfield - Number - Field Size property set to Byte.
Now, when the code above runs on this table, the schema returned is not complete
or invalid altogether (maybe just incomplete).
The AutoNumberfield column should show in the IsKey property as True (or checked)
but it doesn't. I noticed this problem or SQL Server primary key's as well, the
primary keys are not checked in IsKey at all! How can I determine if the
specified field is or is part of the primary key for the specified table?
The Hyperlinkfield returns the exact same information as the memo field. How can
I tell these apart? I have checked the ExtendedProperties property while
running some tests using a data adapter and dataset but the extendedproperties
are NEVER set so I can't query those to find out.
The Decimalfield and Currencyfield both return the same datatype (Numeric) and
the Numberfield returns the property datatype (Integer). But notice that the
Decimalfield is in fact a Number while the field size has been set to Byte (or
decimal). Why does this return Number? How can I tell these two apart (Number
with Field Size set to something)?
Ok, enough questions already
Thanks in advance...
Mythran