知识总结
将桌面数据储存于数据库中
1、先打通 webserivce 到数据库通道,这一步比较简单,
通过调用 bll- dal - asmx 三层依次调用访问。
2、c++桌面通过调用接口
定义接口做了一段串拼接抄作
int CSeatArrangeMainDlg::WriteSeatSettingInfoIntoDB(int RoomId, string TeacherIP, string TeacherMac, int SeatRowCount, int SeatColCount,
int SeatArrangeDirect, string StuIPStart, string StuIPEnd, string RoomComputerNum, string HostMacAddr, int ElectricType,
string RoomVersion, string CentralIP, int CentralPort, string TerminalIP, int TerminalPort, string RecordServerIP)
{
CString strUrl = L"http://localhost:2782/WebService/Mgr_Classroom.asmx/"; strUrl=GetUrl();
if (strUrl.IsEmpty())
{
return -2;
}
CString strWebMethodName = _T("WS_G_CRMgr_WriteSeatSettingInfoIntoDB");
strUrl += strWebMethodName;
strUrl += _T("?");
string strParameters = "";
strParameters += "RoomId=";
strParameters += to_string(RoomId);
strParameters += "&TeacherIP=";
strParameters += TeacherIP;
strParameters += "&TeacherMac=";
strParameters += TeacherMac;
strParameters += "&SeatRowCount=";
strParameters += to_string(SeatRowCount);
strParameters += "&SeatColCount=";
strParameters += to_string(SeatColCount);
strParameters += "&SeatArrangeDirect=";
strParameters += to_string(SeatArrangeDirect);
strParameters += "&StuIPStart=";
strParameters += StuIPStart;
strParameters += "&StuIPEnd=";
strParameters += StuIPEnd;
strParameters += "&RoomComputerNum=";
strParameters += RoomComputerNum;
strParameters += "&HostMacAddr=";
strParameters += HostMacAddr;
strParameters += "&ElectricType=";
strParameters += to_string(ElectricType);
strParameters += "&RoomVersion=";
strParameters += RoomVersion;
strParameters += "&CentralIP=";
strParameters += CentralIP;
strParameters += "&CentralPort=";
strParameters += to_string(CentralPort);
strParameters += "&TerminalIP=";
strParameters += TerminalIP;
strParameters += "&TerminalPort=";
strParameters += to_string(TerminalPort);
strParameters += "&RecordServerIP=";
strParameters += RecordServerIP;
strUrl += LGTools::StringToCString(strParameters);
LGTools::ConvertGBKToUtf8(strUrl);
string strGetInfo;
CWebCommand pWebCommond;
int iRet = pWebCommond.HttpGet(strUrl, NULL, strGetInfo);
int iCRID = LGTools::ParseIntReturnValueFromHttpGet(strGetInfo);
return iCRID;
}
2总结
a、刚开始时候自己未调试成功,主要问题出在webservice 不熟悉,拼接字符连个HTTP都没有写上
b、中间一定不要有任何空格符号不然肯定会错的
总结 感悟