I'm using the following to get the table structure:
The problem I have is that no matter what I try I can not get the 3rd value (character_maximum_length)
strVALUE(2) = MyRead.GetInt32(2).ToString
The erro I get is: Specified cast is not valid.
And I'm sure the character_maximum_length is in Integer
"Taxes are the fees we pay for civilized society" G.W.
Code:
SQL = "SELECT column_name, data_type, character_maximum_length FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" & strTABLE & "'"
Call OPEN_DB()
Dim MyCMD As New OleDb.OleDbCommand(SQL, MyConn)
Dim MyRead As OleDb.OleDbDataReader
MyRead = MyCMD.ExecuteReader
Dim iItem As New ListViewItem(), intI As Int16
While Not MyRead.Read = False
strVALUE(0) = MyRead.GetString(0)
strVALUE(1) = MyRead.GetString(1)
strVALUE(2) = MyRead.GetInt32(2).ToString
iItem = New ListViewItem(strVALUE)
lstColumns.Items.Add(iItem)
End While
MyRead.Close()
MyConn.Close()
MyConn.Dispose()
The problem I have is that no matter what I try I can not get the 3rd value (character_maximum_length)
strVALUE(2) = MyRead.GetInt32(2).ToString
The erro I get is: Specified cast is not valid.
And I'm sure the character_maximum_length is in Integer
"Taxes are the fees we pay for civilized society" G.W.