dbprj.cpp
资源名称:1731.rar [点击查看]
上传用户:swkcbjrc
上传日期:2016-04-02
资源大小:45277k
文件大小:3k
源码类别:
游戏
开发平台:
Visual C++
- // dbprj.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include "dbcheck.h"
- CDBCheck dbcheck("DSN=db;UID=sa;PWD=sina.com");
- BOOL SetUserInfo(CString strUserName)
- {
- NODECURUSERINFO NodeCurUserInfo;
- NodeCurUserInfo.strUserName =strUserName;
- NodeCurUserInfo.nUserLevel =5;
- NodeCurUserInfo.nUserScore =500;
- NodeCurUserInfo.nTotalCardCount =20;
- NodeCurUserInfo.nVictoryCount =5;
- NodeCurUserInfo.nBreakNetCount =3;
- NodeCurUserInfo.strEnterText ="I comes";
- NodeCurUserInfo.strExitText ="I goes";
- NodeCurUserInfo.bShowRegardText =TRUE;
- NodeCurUserInfo.bShowMoveText =TRUE;
- NodeCurUserInfo.bShowEnemyText =TRUE;
- NodeCurUserInfo.bShowSysInfo =TRUE;
- NodeCurUserInfo.fRoomBreakRate =0.5;
- NodeCurUserInfo.nRoomNetSpeed=5000;
- NodeCurUserInfo.nRoomPlayNum =1;
- NodeCurUserInfo.nRoomTableNum =1;
- NodeCurUserInfo.strRoomName ="NO1";
- NodeCurUserInfo.bTableBreakRate =TRUE;
- NodeCurUserInfo.bTableDislike=TRUE;
- NodeCurUserInfo.bTableNetRate =TRUE;
- NodeCurUserInfo.fTableBreakRate =TRUE;
- NodeCurUserInfo.nTableNetRate =TRUE;
- NodeCurUserInfo.strAllFriend ="";
- NodeCurUserInfo.strAllEnemy="";
- NodeCurUserInfo.nEqualCount=2;
- NodeCurUserInfo.nLossCount=1;
- NodeCurUserInfo.bAgreeLook=1;
- return dbcheck.DoUpdateRecordset(strUserName,&NodeCurUserInfo);
- }
- int main(int argc, char* argv[])
- {
- printf("Hello World!n");
- printf("Dbcheck demo program!n");
- NODECURUSERINFO info;
- if (dbcheck.IsUserValid("test","123",&info))
- //if check pass
- {
- Alert("Check UserName Password ok.rn");
- Alert("Read User information from database:rn");
- CString strFormat;
- strFormat="userlevel=%d,rn userscore=%d,rn ";
- strFormat+="totalcardcount=%d,rn victorycount=%d,rn breaknetcount=%d,rn ";
- strFormat+="entertext='%s',rn exittext='%s',rn showregardtext=%1d,rn showmovetext=%1d,rn ";
- strFormat+="showenemytext=%1d,rn ";
- strFormat+="showsysinfo=%1d,rn booltabbreakrate=%1d,rn booltabdislike=%1d,rn ";
- strFormat+="booltabnetrate=%1d,rn roombreakrate=%f,rn tablebreakrate=%f,rn ";
- strFormat+="roomnetspeed=%d,rn roomplaynum=%d,rn roomtablenum=%d,rn ";
- strFormat+="tablenetrate=%d,rn allenemy='%s',rn allfriend='%s',rn roomname='%s',rn ";
- strFormat+="equalcount=%d,rn losscount=%d,rn agreelook=%drn ";
- printf(strFormat,5,
- info.nUserScore ,info.nTotalCardCount ,
- info.nVictoryCount ,info.nBreakNetCount ,
- info.strEnterText ,info.strExitText ,
- info.bShowRegardText ,info.bShowMoveText ,
- info.bShowEnemyText ,info.bShowSysInfo,
- info.bTableBreakRate,info.bTableDislike,info.bTableNetRate,
- info.fRoomBreakRate,info.fTableBreakRate,
- info.nRoomNetSpeed,info.nRoomPlayNum,info.nRoomTableNum,
- info.nTableNetRate,info.strAllEnemy,info.strAllFriend,
- info.strRoomName,info.nEqualCount,info.nLossCount,
- info.bAgreeLook);
- }
- else
- {
- Alert("UserName Password check error.please check your user/pass.rn");
- }
- Alert("rnUpdate User:test info.rn");
- if (SetUserInfo("test"))
- Alert("Update success.rn");
- else
- Alert("Update Fail.rn");
- return 0;
- }