// Obtain the server time *********************************** **************
Cdatabase m_dbagent;
M_dbagent.openex ("DSN = eidsql; uid = sa; Pwd = 123456 ");
Cstring SQL, STR;
// Ctime tcurtime;
Cstring strcurtime;
Crecordset * p_rs = new crecordset; // defines the record set object pointer
P_rs-> m_pdatabase = & m_dbagent; // point the database to m_dbagent
SQL = _ T ("select getdate () as curtime"); // use the set function to query the number of objects
P_rs-> open (afx_db_use_default_type, SQL); // obtain a valid query record set
P_rs-> getfieldvalue ("curtime", strcurtime); // retrieve the data in the query record set
P_rs-> close ();
M_dbagent.close ();
Delete p_rs;
// Shezhi
Int nyear = strtol (strcurtime. Left (4), 0, 10 );
Int nmonth = strtol (strcurtime. mid (5, 2), 0, 10 );
Int nday = strtol (strcurtime. mid (8, 2), 0, 10 );
Int nhour = strtol (strcurtime. mid (11, 2), 0, 10 );
Int nminute = strtol (strcurtime. mid (14, 2), 0, 10 );
Int nsecond = strtol (strcurtime. mid (17, 2), 0, 10 );
//************************************** **********************