Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / August 2005



Tip: Looking for answers? Try searching our database.

How can you determine table structure in VB.NET using OLEDB

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JohnR - 13 Jul 2005 17:36 GMT
Using OLEDB to access visual foxpro DBF files in VB.NET (ultimately will
also access SQL server and Oracle tables, too).

I am trying to write a general routine that will check to see if my tables
are the most current structure.  I have successfully handled the case of
creating new tables and creating new columns that previously didn't exist.
What I'm stuck on is how to handles CHAR columns where the column size
changes.  I can't seem to find a way to determine the column size.

When I connect to the data table the COLUMN object has a property called
MAXLENGTH but that property is always -1 even though the column was created
with a CHAR(25) definition  (I would have expected maxlength to be 25).

Is there any way to see or query the actual table structure so I can get the
actual field size.  I'm sure I'm missing something simple.

Thanks for any help...  \
John
William (Bill) Vaughn - 13 Jul 2005 18:11 GMT
This is very easy in the 2.0 Framework. The Connection class now supports
the GetSchema method that returns (very) detailed metadata about any
selected database object. I understand it works with SQL Server and Oracle.
I don't know about VFP.

Signature

____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

> Using OLEDB to access visual foxpro DBF files in VB.NET (ultimately will
> also access SQL server and Oracle tables, too).
[quoted text clipped - 15 lines]
> Thanks for any help...  \
> John
JohnR - 30 Aug 2005 21:43 GMT
Thanks, Bill... I'll try it again in 2.0... Right now the judgement was that
you can't retrieve that info from a standalone DBF-CDX combination.

Regards, John

> This is very easy in the 2.0 Framework. The Connection class now supports
> the GetSchema method that returns (very) detailed metadata about any
[quoted text clipped - 21 lines]
>> Thanks for any help...  \
>> John
JohnR - 30 Aug 2005 21:59 GMT
Oops! Sorry Bill, I replied to the wrong posting.  I had another posting
where I wanted to know if I could retrieve the index columns from the table
(ie from the associated CDX file).  The answer to that question was no.
Pertaining to this question, yes, I discovered the .GETSCHEMA method, and it
did, indeed, provide me with the column size info.

Sorry for the confusion... it's what happens when your fingers type faster
than your brain thinks!

> Thanks, Bill... I'll try it again in 2.0... Right now the judgement was
> that you can't retrieve that info from a standalone DBF-CDX combination.
[quoted text clipped - 26 lines]
>>> Thanks for any help...  \
>>> John
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.