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

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
nickmuesAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
mahesh1402Connect With a Mentor Commented:
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
 
mahesh1402Commented:
You may use SQL statement 'ALTER TABLE tableName .....'

-MAHESH
0
 
yogesh28577Commented:

 
      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
All Courses

From novice to tech pro — start learning today.