Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CDatabase, CRecordset

Status
Not open for further replies.

Agenten

Programmer
Joined
Jul 17, 2002
Messages
3
Location
SE
Hello,
Can anyone give me an example how to use CDatabase and CRecordset to insert and delete in "MYDB" ?
Show me the steps how to do it,
 
CDaoDatabase MyDatabase; //Create Object
//Open Database
MyDatabase.Open( "Pathname of your Database", FALSE, FALSE, _T("") );

CDaoTableDef td( &MyDatabase ); //Create Tabledef
td.Open("YourTable" ); //Open it
CDaoRecordset tabell;
tabell.Open(&td, dbOpenTable, 0 );
COleVariant vrnt = tabell.GetFieldValue("FeldOfInterest" ); //Get the Value
...
//Close it all
tabell.Close();
td.Close();
MyDatabase.Close();

Do not forget to check, if Your names are right (work with Exceptions) etc. etc.
At best, use Daoview and Daotable MFC samples.
You can search for keyword CDaoRecordset - there are a lot of answers on TekTips (my sample too)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top