CodePudding user response:
VS2013 MFC connection Access database (ADO) version of the instance in detail the operation (including Combo Box reading the database content, with source code)CodePudding user response:
String 1, using ADO to build links, links to access database,Moderators to recommend specific operation see 1 floor, very detailed,
2, the database of the data, delete, add, change is realized by using SQL statements, and then use ADO to send and executing SQL statements,
For example,
Check: theApp. SQLCMD. The Format (_T (" SELECT * from the Users "));//you can access to the records of all the fields in the Users table,
Delete: SQLCMD=_T (" Delete from the Users where [UserName]='") + m_strUserName + _T ("' ");
Add: SQLCMD=_T (" insert into Users (UserName) values (" ");
SQLCMD +=m_strUserName;//UserName
SQLCMD +=_T (" ') ");
Change: theApp pRecordset - & gt; MoveFirst ();
TheApp. PRecordset - & gt; To Move (m_iCurrentIndex);
TheApp. PRecordset - & gt; PutCollect (" UserPwd ", _variant_t (m_strUserPwd));
TheApp. PRecordset - & gt; The Update ();
Need to learn SQL commands, ADO operation instruction, needs to pay attention to the field and type for each table,
There is no shortcut to learning needs frequently to test,,
CodePudding user response:
Thank you so much! I was the first time contact with SQL, the command is not familiar with, also have to learn the acquisition of knowledge.