Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 108
  • Last Modified:

Old database of access needs to be altered through VC++

while handling old project it is required to update  database at  client side.Following code I  have  done.Instead of dynaset,I tried dynamic,snapshot,forwardonly  but nothing works for update script.for select string it works fine.
Please  help  me  as early as possible
       
       
 CString sDsn;
	 sDsn= _T("ODBC;DSN=Report;Pwd=tratra"); 
	 CDatabase objMerilDB;
	 objMerilDB.Open(NULL,false,false,sDsn);
	 CRecordset objRecordSet;
	 objRecordSet.m_pDatabase = &objMerilDB;
	 CString strQuery = "ALTER TABLE result ALTER COLUMN IdTest Text";
	 objRecordSet.Open(CRecordset::OpenType::dynaset, strQuery);

Open in new window

0
ADITYA RAO
Asked:
ADITYA RAO
1 Solution
 
sarabandeCommented:
you may not use a CRecordset. instead, after objMerilDB.Open has returned without error, use

objMerilDB.SQLExecute(_T("ALTER TABLE result ALTER COLUMN IdTest Text"));

Open in new window


Sara
0
 
ADITYA RAOAuthor Commented:
Yes this solution worked
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now