本文整理汇总了C++中CSession::Open方法的典型用法代码示例。如果您正苦于以下问题:C++ CSession::Open方法的具体用法?C++ CSession::Open怎么用?C++ CSession::Open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSession
的用法示例。
在下文中一共展示了CSession::Open方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getSymbolData
void LimitMappingScripwise::getSymbolData()
{
HRESULT hr;
CoInitialize(NULL);
CDataSource connection;
CSession session;
CCommand<CAccessor<CTrade_Table> > artists1;
connection.OpenFromInitializationString(L"Provider=SQLNCLI11.1;[email protected];Persist Security Info=False;User ID=sa;Initial Catalog=TradeDataBase;Data Source=68.168.101.187;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=WINDOWS-LOJSHQK;Initial File Name=\"\";Use Encryption for Data=False;Tag with column collation when possible=False;MARS Connection=False;DataTypeCompatibility=0;Trust Server Certificate=False;Application Intent=READWRITE");
session.Open(connection);
_bstr_t strCommand="";
CString sel_login=GridTradeAndOrder::m_selected_login;
sel_login=sel_login.Mid(0,6);
_bstr_t strcode=sel_login;
//select distinct symbol,0 as 'Limit','' as 'Client_group','' as 'Client_Group1','' as 'Client_Group2','' as 'v','' as 'ba','' as 'TYPE','' as 'volume' ,'' AS 'cHECKtRADE' from mt5_deals where [Action] in (0,1) and symbol not in (select Symbol from Limit_Mapping where [login]='" + GridTradeAndOrder::m_selected_login + "' )union select Symbol,Limit from Limit_Mapping where [login]='" + GridTradeAndOrder::m_selected_login + "' "
strCommand="select distinct symbol,0 as 'LimitBuy',0 as 'Client_group','' as 'Client_Group1','' as 'Client_Group2','' as 'v','' as 'ba','' as 'TYPE','' as 'volume' ,'' AS 'cHECKtRADE' from mt5_deals where [Action] in (0,1) and symbol not in (select Symbol from Limit_Mapping where [login]='" + GridTradeAndOrder::m_selected_login + "' )union select Symbol,Limit,LimitSell as 'Client_group','' as 'Client_Group1','' as 'Client_Group2','' as 'v','' as 'ba','' as 'TYPE','' as 'volume' ,'' AS 'cHECKtRADE' from Limit_Mapping where [login]='" + GridTradeAndOrder::m_selected_login + "' ";
char* strCommand_char=(char*)strCommand;
hr=artists1.Open(session,strCommand_char);
int rows_count=0;
if(SUCCEEDED(hr))
{
while (artists1.MoveNext() == S_OK)
{
e_grid.QuickSetText(0,rows_count,artists1.m_Symbol );
e_grid.QuickSetText(1,rows_count,artists1.m_Order);
e_grid.QuickSetText(2,rows_count,artists1. m_Time);
rows_count=rows_count+1;
}
}
artists1.Close();
session.Close();
connection.Close();
}
示例2: Show_NPBPStype1
UINT Show_NPBPStype1(void *pParam)
{
CNPBPSType1Grid* pThis= (CNPBPSType1Grid*)pParam;
CoInitialize(NULL);
CDataSource connection;
CSession session;
CCommand<CAccessor<NPBPSType1Table> > artists1;
HRESULT hr;
hr=connection.OpenFromInitializationString(L"Provider=SQLNCLI11.1;[email protected];Persist Security Info=False;User ID=sa;Initial Catalog=Tradedatabase;Data Source=68.168.101.187;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=WINDOWS-LOJSHQK;Initial File Name=\"\";Use Encryption for Data=False;Tag with column collation when possible=False;MARS Connection=False;DataTypeCompatibility=0;Trust Server Certificate=False;Application Intent=READWRITE");
if(SUCCEEDED(hr))
{
hr=session.Open(connection);
while (true )
{
CString strCommand=L"";
strCommand.Format(L"proc_Type2");
_bstr_t bstrCommand="";
bstrCommand=strCommand;
char* strCommand_char=(char*)bstrCommand;
if(SUCCEEDED(hr))
{
hr=artists1.Open(session,strCommand_char);
}
CNPBPSType1Grid::dealing_mutex.Lock();
if(SUCCEEDED(hr))
{
CNPBPSType1Grid::m_st_Dealing_Array.Clear();
CNPBPSType1Grid::st_Dealing m_st_Dealing={};
while (artists1.MoveNext() == S_OK)
{
CMTStr::Copy(m_st_Dealing.Section ,artists1.m_Section );
CMTStr::Copy(m_st_Dealing.Login ,artists1.m_login );
m_st_Dealing.Order =artists1.m_Order;
CMTStr::Copy(m_st_Dealing.Order_In_Time,artists1.m_Order_In_Time ) ;
m_st_Dealing.Deal=artists1.m_Deal ;
CMTStr::Copy(m_st_Dealing.Symbol ,artists1.m_Symbol );
CMTStr::Copy(m_st_Dealing.Type1 ,artists1.m_Type1 );
m_st_Dealing.Volume =artists1.m_Volume ;
m_st_Dealing.Price =artists1.m_Price;
CMTStr::Copy(m_st_Dealing.Comment,artists1.m_Comment);
CMTStr::Copy(m_st_Dealing.Status,artists1.m_Status);
CMTStr::Copy(m_st_Dealing.Type,artists1.m_Type);
CMTStr::Copy(m_st_Dealing.SubType,artists1.m_SubType);
CNPBPSType1Grid::m_st_Dealing_Array.Add(&m_st_Dealing);
}
artists1.Close();
}
CNPBPSType1Grid::dealing_mutex.Unlock();
Sleep(1000);
}
}
return 0;
}