Learning VC is a tough process. If you encounter some experience people in the process of learning, you will be as simple as you have changed. Here I have included some experience in learning using the VC process, in order to make progress together with you.
1, get system time
method:
Systemtime system;
:: GetSystemTime (& Systime);
CTime Time (SYSTIME);
2, add ODBC data sources in the program
Method: Use the SQLConfigDataSource function. E.g:
SQLConfigDataSource (null, odbc_add_dsn,
(LPSTR) "SQL Server",
(Lpstr) "DSN = Medicine1998 / 0"
"Server = DEC / 0"
"Database = Medicine1998 / 0")))))
// Add an ODBC data source, which is
// SQL Server, the server is DEC, the name is Medicine1998,
// Database for Medicine1998
3. Method for using DBGRID controls in Visual C
(1) Insert a MicrosoftRemoteData control;
(2) Set its DataSource as the desired ODBC data source;
(3) Set the username and password;
(4) Write into the SQL query statement;
(5) Insert a DBGRID control;
(6), set to binding mode;
(7), set the data source that is bound to the Microsoft-RemoteData control of the previously inserted Microsoft-RemoteData control;
(8), since only the top two column display (at least I don't know how to modify the third column), in order to reset the list of the column of each column, it is also necessary to specify the displayed column, should be modified The query statement in the front MicrosoftRemoteData control, specifies the acquisition column and change the column name, for example: Select Name As Name, Phone AS Phone from Address. This statement is to select both Name and Phone from Table Address and specify the displayed column name "Name" and "Phone".
4. In the ODBC programming, you can replace the filter string with parameters in the filter to dynamically change the filter at runtime, but this parameter must be declared as follows:
(1) Add member parameters in the definition of the record set:
Class CStudentset: Public CRecordset
{
// Field / param data
// {{AFX_Field (CstudentSet, CRecordset)
CString m_strfirstname;
CString m_strlastname;
CString M_STRSTUDENTID;
CString M_StrGradyear;
//}} AFX_FIELD
CString M_STRGRADYRPARAM; // Member Parameters
}
(2) Change the DOFIELDEXCHANGE member function in the CPP file, and call a RFX function to each member parameter you add in the class, as follows:
PFX-> setfieldType (cfieldexchange :: param);
// Indicates that the following is given the parameter binding
// RFX Calls for parameter data members / / Add RFX call:
PFX-> RFX_Text (PFX, "BookName", M_STRGRADYRPARAM);
Among them, BookName is the column name to add parameters thereon, followed by the parameter name.
(3) In the build function of your Recordset class, add the value of the M_NPARAMS member variable that reflects the number of parameters.
(4) Can then be "?" Instead of the variable filter parameters in your SQL filter string, this correspondence is the order of "?" To strictly abide by the order of RFX calls. Then give the value of the filter parameter, you can use this value to replace "?". Note that the value of the filter parameter must give