Computing.Net > Forums > Programming > Add field to recordset VB6

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Add field to recordset VB6

Reply to Message Icon

Name: Global
Date: June 9, 2003 at 07:52:18 Pacific
OS: WIN 2000
CPU/Ram: 1800 MHz
Comment:

Is there a way to add a field to an already defined recordset at 'RUN-TIME' using VB6?

Thanks,
Global



Sponsored Link
Ads by Google

Response Number 1
Name: Chi Happens
Date: June 13, 2003 at 19:21:09 Pacific
Reply:

If you want to add a field to the database table?

You need to use an ADODB.Connection object and the SQL command ALTER TABLE

Like this:
Dim ConnString ' Connection String
Dim CN As ADODB.Connection

Set CN = CreateObject("ADODB.Connection")

ConString = [Connection String] - You have to type this in, it can be a DSN entry or a complete connection string.

CN.Open ConnString
SQL = "ALTER TABLE MyTable ADD COLUMN NewField c(20)"
CN.Execute SQL

CN.Close

Set CN = Nothing


0
Reply to Message Icon

Related Posts

See More


Free XML Parser for C++, ... Protected Updater



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Add field to recordset VB6

Perl script - add text to a jpg ima www.computing.net/answers/programming/perl-script-add-text-to-a-jpg-ima/3331.html

problem to install vb6 to winxp pro www.computing.net/answers/programming/problem-to-install-vb6-to-winxp-pro/11413.html

C++ - add color to screen output www.computing.net/answers/programming/c-add-color-to-screen-output/8187.html