Programmatically Determin Max Field Length

C

crjunk

I'm trying to programmatically determine the maximum field length for
an Access table. I've had problems using the examples that I have come
across on the internet. Can anyone provide me with a simple way to
determine the max length of a field?

Thanks,
CR Junk
 
C

crjunk

crjunk said:
I'm trying to programmatically determine the maximum field length for
an Access table. I've had problems using the examples that I have come
across on the internet. Can anyone provide me with a simple way to
determine the max length of a field?

Thanks,
CR Junk

I was able to obtain the maximum field lenght by using the following
code:

Dim tmpML as String
Dim cmd As OleDbCommand = New OleDbCommand("SELECT * FROM
MyInfo WHERE 1 = 0", objConn)
Dim daMaxLength As OleDbDataAdapter = New OleDbDataAdapter(cmd)
Dim myDataSet As DataSet
myDataSet = New DataSet
daMaxLength.Fill(myDataSet, "MyInfo")
daMaxLength.FillSchema(myDataSet, SchemaType.Source, "MyInfo")

tmpML =
myDataSet.Tables("MyInfo").Columns("FirstName").MaxLength.ToString


CR Junk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top