1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
void CMyMessage::writedb(String* s, String* f, String* t,String* h, String* p, String* m)
{
SqlConnection* myConnection=new SqlConnection();
SqlCommand* cmd=new SqlCommand();
myConnection->ConnectionString=S"server=*****; database=*******; integrated security=SSPI; packet size=4096; persist security info=false;";
String* strinsert=S"INSERT INTO _syslogtable ( severity, facility, timespan, hostname, processus, message) VALUES (";
strinsert=strinsert->Concat(strinsert,"'",s,"',");
strinsert=strinsert->Concat(strinsert,"'",f,"',");
strinsert=strinsert->Concat(strinsert,"'",t,"',");
strinsert=strinsert->Concat(strinsert,"'",h,"',");
strinsert=strinsert->Concat(strinsert,"'",p,"',");
strinsert=strinsert->Concat(strinsert,"'",m,"')");
cmd->CommandText=strinsert;
cmd->Connection=myConnection;
myConnection->Open();
cmd->ExecuteScalar();
myConnection->Close();
} |
Partager