Is what I always collapse when the oracle database queries, specific error is as follows:
0 x772937b7 (NTDLL. DLL) (OracleLinkTest. Exe) in untreated exception: 0 xc0000374: pile has been damaged, (parameters: 0 x772acdd8),
Internet also found several methods, but failed to solve the problem of my code is as follows:
Insert the code:
Void Employees: : InsertData (string& StrID string& StrTaskID string& StrResult string& StrTestTime string& StrAutoTestID)
{
//get the system time
Char buf [50]={0};
Time_t timep;
Time (& amp; Timep);
TMP struct tm;
Localtime_s (& amp; TMP, & amp; Timep);
Char bufTime [100]={0};
Sprintf_s (bufTime, "% d % d - % d % d: % d: % d", 1900 + TMP tm_year, 1 + TMP. Tm_mon, TMP. Tm_mday, TMP. Tm_hour, TMP. Tm_min, TMP. Tm_sec);
String strtime (bufTime);
//insert database
//string strSql="insert into ASTS_TEST_LOG (ID, TASK_ID, RESULT, TEST_TIME AUTOTEST_ID) values (: 1, 2, 3, to_date (: 4, 'yyyy - mm - dd hh24: mi: ss'), : 5)";
String strSql="insert into ASTS_TEST_LOG (ID, TASK_ID, RESULT, TEST_TIME AUTOTEST_ID) values (sys_guid (), : 1:2, to_date (:, 3 '- dd yyyy - mm hh24: mi: ss'), : 4)";
PStmt - & gt; SetSQL (strSql);
//pStmt - & gt; SetString (1, stringID);//use of Oracle database to produce the ID of the filling, instead of the random number ID here, so comment out
PStmt - & gt; SetString (1, "22");
PStmt - & gt; SetString (2, strResult);
PStmt - & gt; SetString (3, strtime);
PStmt - & gt; SetString (4, strAutoTestID);
PStmt - & gt; ExecuteUpdate ();
}
Query code is as follows:
Void Employees: : SelectData ()
{
The ResultSet * rs=pStmt - & gt; ExecuteQuery (" select * from ASTS_TEST_LOG ");
While (rs - & gt; Next ())
{
String quantity=rs - & gt; Get string (1);//get the first column as a string out the value of the first column (corresponding to a string type)
STD: : cout<" String: "& lt;
//close the result set
PStmt - & gt; CloseResultSet (rs);
}
ID is the name of the field, the data type is VARCHAR2 (50)
Details are as follows: if I insert ID, in this way the query no problem, but if I use sys_guid () to produce ID, in this way the query can appear the wrong, and I can guarantee that the database of this field is not null, at least one row data, the result is a running the above mistakes,
Ask friends to help, in this thanked first!
CodePudding user response:
This is a problem of c + +, you see is a question of whether the stack,There's a similar post, has been solved, you under reference:
http://bbs.csdn.net/topics/392068284
CodePudding user response: