?
Solved

How to get field's DefinedSize from ADO.NET?

Posted on 2005-03-10
1
Medium Priority
?
671 Views
Last Modified: 2010-05-18
I know to get field size from a table by ado is as below:

Set Recordset = Server.CreateObject("ADODB.Recordset")
Recordset.Open "SELECT * FROM TABLE", connection
Size = Recordset.Fields("Field1").DefinedSize

But how to do the same for ado.net?
Please give a code example. Thanks
0
Comment
Question by:limct
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 10

Accepted Solution

by:
lengreen earned 2000 total points
ID: 13514849
Hi limct,

'SQL Server Connection

Dim strSQL as string = "SELECT FirstName,LastName FROM Employees;"
Dim strConnection as String = "server=;database=Northwind; User Id=sa;password=;"

Dim objDataSet As New DataSet()
Dim objConnection As New SqlConnection(strConnection)

'create a new DataAdapter using the connection object and select statement
Dim objDataAdapter As New SqlDataAdapter(strSQL, objConnection)

'fill the dataset with data from the DataAdapter object
objDataAdapter.Fill(objDataSet, "Employees")

Dim Size as integer

Size = objDataSet.Tables("Employees").Columns("FirstName").Maxlength


Cheers!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question