Solved

How can I add a field to an existing table via ADO recordsets?

Posted on 2006-11-06
3
174 Views
Last Modified: 2013-11-20
I have searched the examples and I would like to add a field to an existing recordset via a connection pointer.
I want the changes to take place permanently also.

Help!

Thanks

Nick
0
Comment
Question by:nickmues
[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
  • 2
3 Comments
 
LVL 22

Expert Comment

by:mahesh1402
ID: 17882650
You may use SQL statement 'ALTER TABLE tableName .....'

-MAHESH
0
 
LVL 22

Accepted Solution

by:
mahesh1402 earned 125 total points
ID: 17882682
e.g

Adding a new column to an existing table sql statement should be like :

sql = "ALTER TABLE myTable ADD newColumn VARCHAR(255) " ;

-MAHESH
0
 
LVL 1

Expert Comment

by:yogesh28577
ID: 17888306

 
      m_pConnectionAPCLASS.CreateInstance (__uuidof( Connection ));
      m_pConnectionAPCLASS->Open ("PROVIDER=MSDASQL;dsn=lekha;uid=sa;pwd=;database=core;",_bstr_t(L""),_bstr_t(L""),adModeUnknown);

Cstring query ="ALTER TABLE city ADD state VARCHAR(255)";
CComVariant v(0L);
_RecordsetPtr recset;
 recset.CreateInstance(__uuidof(Recordset));
recset=m_pConnectionAPCLASS->Execute(query.AllocSysString (),&v,adOptionUnspecified);
      recset->Close();

in this way you add new coloumn in existing  table
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Smart Camera scanning and reading information 3 126
Modbus - whats the maximum I can store in one register? 4 84
wordcount challenge 11 163
x-bar in Google Sheets 2 129
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

739 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