Changing the field width of an ADO table?

I thought everything in the database part of my code was working, but then someone wanted to add an 11 character string to a field that was set to 10 characters.  Is there a simple way of changing a field width in an ado table?  I have done this before with Paradox and DbIsam, but the same approach isn't working with ADO.  I already create any tables or fields that are not found in the mdb file as part of my startup so the system can be deployed to an older version without having to modify the database st
ructure manually, however, I would also like to be able to change the definition of a couple of string fields to make them wider during startup to eliminate this problem.

I have an AdoQuery and AdoCommand object that is already used for other structure changes, so using these components would be the best approach.

I was thinking along the lines of something like this

procedure ChangeFieldWidth(sFieldName: string; iFieldLength: integer; adoq: TAdoQuery; cmd: TAdoCommand);
begin
  iFieldNumber := adoq.DataSource.DataSet.FieldDefs.IndexOf(sFieldName);
  adoq.DataSource.DataSet.FieldDefs[iFieldNumber].Size := iFieldLength;
  //do something to "make it happen"....
end;
0
Trevor
10/11/2011 9:27:14 PM
embarcadero.delphi.ado 597 articles. 1 followers. Follow

1 Replies
572 Views

Similar Articles

[PageSpeed] 10

On Tue, 11 Oct 2011 14:27:14 -0700, Trevor Hand <> wrote:

If you want to do anything involving the metadata via ADO you need to
look at ADOX which is basically an additional TLB that you probably
already have installed, you just need to import into delphi, and
rename some of the components (because the default names are the same
as BDE (TTable etc). if you Google "ADOX Delphi" you will find what
you need.

regards

Smurf

>I thought everything in the database part of my code was working, but then someone wanted to add an 11 character string to a field that was set to 10 characters.  Is there a simple way of changing a field width in an ado table?  I have done this before with Paradox and DbIsam, but the same approach isn't working with ADO.  I already create any tables or fields that are not found in the mdb file as part of my startup so the system can be deployed to an older version without having to modify the database s
t
>ructure manually, however, I would also like to be able to change the definition of a couple of string fields to make them wider during startup to eliminate this problem.
>
>I have an AdoQuery and AdoCommand object that is already used for other structure changes, so using these components would be the best approach.
>
>I was thinking along the lines of something like this
>
>procedure ChangeFieldWidth(sFieldName: string; iFieldLength: integer; adoq: TAdoQuery; cmd: TAdoCommand);
>begin
>  iFieldNumber := adoq.DataSource.DataSet.FieldDefs.IndexOf(sFieldName);
>  adoq.DataSource.DataSet.FieldDefs[iFieldNumber].Size := iFieldLength;
>  //do something to "make it happen"....
>end;
0
Ian
10/12/2011 3:30:24 PM
Reply:

Similar Artilces:

Convert Delphi 5 ADO App to Delphi 2007 ADO.NET
I have an appliction tha that is writen in Delphi 5 with ADOConnetion, ADOTable, and ADOQuery components. I need to upgrade to Delphi 2007 and use ADO.NET. I have the program building in with Delphi 2007. Is there anything I need to do to convert the ADO to ADO.NET? > I need to upgrade to Delphi 2007 and use ADO.NET. Why ? -- With best regards, Dmitry Arefiev AnyDAC (www.anydac.com) - Oracle, MS SQL Server, IBM DB2, MySQL, Firebird, Interbase, PostgreSQL, Sybase ASA, SQLite, MS Access, DBX, ODBC, InMem - universal high-speed native data access engine Reasons for ...

ASA7 ADO & Delphi ADO ?? Anyone is using it?
Any comments? Is it working? Any Problems? Thanks Hi, PR <noemail@no.com> schrieb in im Newsbeitrag: BoTThJaq$GA.89@forums.sybase.com... > Any comments? Is it working? Any Problems? I tried to connect to ASA7 via the new OLE DB - Provider and ADOExpress from Delphi 5.01. No chance. Only the error message 'Invalid Enum Value'. About the new provider I haven't heard anything good until now... Regards Frank Frank, I've experienced the same problem with the ASA 7 OLEDB Provider. I'm not sure if this is a bug in the AsaProvider or Delp...

ADO to ADO.NET
I'm an ASP programmer (VBScript) moving on to ASP.NET. So far I'm using:Microsoft Visual Studio 2003ASP.NET with C#I'm working on converting my code over to C#, from VBScript. Now, here is my code in VBScript (modified to better understand it, this is a edited ugly version):Function ExecuteSQL(sqlStatement)    ConnDriver = "Provider=SQLOLEDB; Data Source = " & dbIP & "; Initial Catalog = " & dbName & "; User Id = " & dbUser & "; Password=" & dbPassword     Set connTemp = Server.CreateObject("ADODB.Connection")    c...

ADO not ADO.NET
Hi, I have to connect to a db using adodb (which i select from the references). I have to retrieve the car models from the database and bind them to a listbox. I am not sure how to proceed and I can't find any articles on ADO with .net and data binding. Here is the code that i tried but it only retrieves the car model for the specified id. If I delete the id it doesn't work. Also it writes the car model in the listbox vertically such as: B M W CODE: Imports System.Data Imports ADODB Imports System.Data.OleDb Public Class listboxADO Inherits System.Web.UI...

ADO - create table and fields in code
I am able to create a table using the following code but I need to create a memo field in Microsoft Access. Anyone know how to create a memo field is greatly appreciated. Thanks in advance. Andy var Cat,Table,Col,Key: Variant; Cat := CreateOLEObject('ADOX.Catalog'); Cat.ActiveConnection := ADODatabase1.DatabaseConnect; Table := CreateOLEObject('ADOX.Table'); Table.Name := 'TEMPTABLE'; //integer - primary - autoincrement sKey := 'TEMPPROFILEID'; Col := CreateOLEObject('ADO...

ADO
I am able to create a table using the following code but I need to create a memo field in Microsoft Access. Anyone know how to create a memo field is greatly appreciated. Thanks in advance. Andy var Cat,Table,Col,Key: Variant; Cat := CreateOLEObject('ADOX.Catalog'); Cat.ActiveConnection := ADODatabase1.DatabaseConnect; Table := CreateOLEObject('ADOX.Table'); Table.Name := 'TEMPTABLE'; //integer - primary - autoincrement sKey := 'TEMPPROFILEID'; Col := CreateOLEObject('ADO...

MySQL Timestamp fields via Delphi ADO?
What are my options to use timestamps via parameterized inserts and selects from Delphi's ADO components (all Delphi versions)? ...

Connect to Paradox tables with ADO: problem with FmtMemo fields [Edit]
Some years ago, I developed a Personal Information Manager (PIM) program using Paradox tables and the BDE. It works fine and customers enjoy it. Recently, I tried to use the dbGo components instead of the BDE (some say ADO is faster whereas BDE is deprecated). No problem with the connection *but all the fields of the database with the ftFmtMemo data type have disappeared from the display* (though they are still in the Paradox database). Is there a solution? Georges Edited by: Georges Trottier on Sep 25, 2011 9:37 AM Hello Georges > some say ADO is faster where...

ADO.NET VS ADO
Hi I am having ADO.NET course these days. I asked the instructor that developing online system like airline reservation system needs to a connected environment to lock/Unlock the table when u read/write to it Can that be acomplished using ado.net. His answer was no ADO.NET is only for disconnected environment and it will not work with online system and i still should use the old ADO. ADO.NET is not a replacment for ADO and both will continue in paralell. IS his answer true that ADO.NET will not replace ADO and both will continue Regards Check this link. Well ADO.NET is pa...

ADO.NET table fields pass to a VB.NET variable
Hi, please help, have a ADO.NET code. 1 Dim conn As New Data.SqlClient.SqlConnection 2 Dim sql As New Data.SqlClient.SqlCommand 3 4 conn = New Data.SqlClient.SqlConnection("Provider=SQLOLEDB.1;Password=dbsystematics;Persist Security Info=True;User ID=sa;Initial Catalog=SARS;Data Source=4G") 5 conn.Open() 6 sql = New Data.SqlClient.SqlCommand("select * from users", conn)   Then i would like to pass the values that the above ADO.NET to a variable.how?please help. JFRBPH12™ You can execute the ...

Opinions about ADO and ADO.NET
Hi everyone again!!! I´m used to develope applications with ADO, but now with .NET to develope a Web Application and a Mobile Web Application, I don't know if I have to use ADO.NET or continue using ADO. What Disadvantages has ADO to built Mobile Applications? In ADO I use ACCESS to create the .mdb files, Can I use .mdb files with ADO.NET? Thanks for all!! Go to ADO.NET NOW ! don't be late and you can use access in ado.net ADO.NET VB.NET/C#/ASP.NET/Oracle Designer 6i DotNet4Arab.com Building a custom web control(vb.net) Well, Thanks for your opinion, but I have...

ADO to ADO.NET help
Hi, I am converting application ASP to ASP.NET.What is the equivalent code in ADO.NET. For each F in RS.Fields FieldName = F.Name Next Thanks, Nate If it is forward only, then you can use datareader for more info on this, check below link Datareader on MSDN Hope it helps!Sreedharhttp://www.w3coder.orgweblog http://weblogs.asp.net/skoganti...

Converting ADO to ADO.NET
Hi, I am trying to convert this code from ADO to ADO.NET I am very new to ADO.NET and am a bit confused on how I would convert this. Basically what I am trying to do is capture the name of the fields of a table to populate a dropdownlistbox. The table name will change every time the program is run. This is not a problem and I can code for that. Here is what I have in ADO (I have tried the wizard but it did not change the code) Dim tblFields As Object Dim myRst As New ADODB.Recordset Dim myField As ADODB.Field Dim myCnn As New ADODB.C...

superreview granted: [Bug 226637] Wrong table width when the table has "table-layout:fixed;" and fixed width and larger width cells than the table width. : [Attachment 162390] patch
Boris Zbarsky <bzbarsky@mit.edu> has granted Bernd <bernd_mozilla@gmx.de>'s request for superreview: Bug 226637: Wrong table width when the table has "table-layout:fixed;" and fixed width and larger width cells than the table width. https://bugzilla.mozilla.org/show_bug.cgi?id=226637 Attachment 162390: patch https://bugzilla.mozilla.org/attachment.cgi?id=162390&action=edit ------- Additional Comments from Boris Zbarsky <bzbarsky@mit.edu> r+sr=bzbarsky ...

Web resources about - Changing the field width of an ADO table? - embarcadero.delphi.ado

Changing room - Wikipedia, the free encyclopedia
A changing room , locker room , dressing room (usually in a sports, theater or staff context) or changeroom (regional use) is a room or area ...

Beyond Timeline: The Changing Face Of Facebook Ads
Despite the hype, timeline may not be the most exciting, or important change coming on March 30. Expanded advertising opportunities may unlock ...

Robert Scoble - Micromedia, how it's changing what we blog - Facebook
Jeremiah Owyang wrote an interesting piece about micromedia and how it's changing what we do on blogs and how we distribute media (er, ideas, ...

8 Ways the Changing Facebook Home Page Will Affect Application Virality
For developers who live and die by the changes Facebook makes to the way information flows through the service, every little Facebook tweak has ...

Changing Lanes (@chginglanes) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Changing the way business decisions are made
We believe that social data has unlimited value, and near limitless application. Today, we’re taking an important step toward unleashing this ...

The Right and Wrong Reasons for Changing Jobs
... your profile is a clue to the folks at LinkedIn that you’re thinking of switching jobs, so don’t be The Right and Wrong Reasons for Changing ...

We're Changing Our Name (Back) to Stack Overflow
We are Stack Overflow. You may know us from such popular websites as Stack Overflow Q&A, Stack Overflow Careers, The Stack Exchange Q&A Network, ...

The Tao of Twitter: Changing your life and business 140 characters at a time - Amazon
It's time to take the mystery out of Twitter. Twitter may be the most powerful business and personal networking platform ever created but it ...

App Store - Voices 2 ~ fun voice changing!
Read reviews, get customer ratings, see screenshots, and learn more about Voices 2 ~ fun voice changing! on the App Store. Download Voices 2 ...

Resources last updated: 1/23/2016 12:11:11 AM