예제 #1
0
    /* 產生sql請求文字檔 */
    public static string SqlRequest(string SQL)
    {
        Cls_File oFile      = new Cls_File();
        string   strContent = "";

        strContent += "BEGIN TRANSACTION [Tran1]" + "\r\n";
        strContent += SQL + "\r\n";
        strContent += "Commit TRAN [Tran1]" + "\r\n";
        string GUID = Guid.NewGuid().ToString();

        oFile.CreatFileCharSet("/sql/request/", GUID + ".txt", strContent, "UTF-8");
        return(GUID);
    }
예제 #2
0
    /* 檢查sql處理情況 RtnMsg='' 10秒逾時 RtnMsg=success 成功 RtnMsg = fail = 失敗  */
    public static string SqlResponse(string GUID)
    {
        Cls_File oFile  = new Cls_File();
        string   RtnMsg = "";

        for (int i = 1; i <= 100; i++)
        {
            RtnMsg = oFile.ReadTextCharSet("/sql/response/", GUID + ".txt", "UTF-8");
            if (RtnMsg != "")
            {
                oFile.DeleteFile("/sql/response/", GUID + ".txt");
                break;
            }
            System.Threading.Thread.Sleep(100);
        }
        if (RtnMsg == "")
        {
            oFile.DeleteFile("/sql/request/", GUID + ".txt");
        }

        return(RtnMsg);
    }