Advertisement
FunkySwerve

SQLExecStatement

Apr 11th, 2014
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.57 KB | None | 0 0
  1. void SQLExecStatement(string sSQL, string sStr0="",
  2.             string sStr1="", string sStr2="", string sStr3="", string sStr4="",
  3.             string sStr5="", string sStr6="", string sStr7="", string sStr8="",
  4.             string sStr9="", string sStr10="", string sStr11="", string sStr12="",
  5.             string sStr13="", string sStr14="", string sStr15="")
  6. {
  7.     int nPos, nCount = 0;
  8.  
  9.     string sLeft = "", sRight = sSQL;
  10.  
  11.     while ((nPos = FindSubString(sRight, "?")) >= 0) {
  12.         string sInsert;
  13.  
  14.         switch (nCount++) {
  15.             case 0:  sInsert = sStr0; break;
  16.             case 1:  sInsert = sStr1; break;
  17.             case 2:  sInsert = sStr2; break;
  18.             case 3:  sInsert = sStr3; break;
  19.             case 4:  sInsert = sStr4; break;
  20.             case 5:  sInsert = sStr5; break;
  21.             case 6:  sInsert = sStr6; break;
  22.             case 7:  sInsert = sStr7; break;
  23.             case 8:  sInsert = sStr8; break;
  24.             case 9:  sInsert = sStr9; break;
  25.             case 10: sInsert = sStr10; break;
  26.             case 11: sInsert = sStr11; break;
  27.             case 12: sInsert = sStr12; break;
  28.             case 13: sInsert = sStr13; break;
  29.             case 14: sInsert = sStr14; break;
  30.             case 15: sInsert = sStr15; break;
  31.             default: sInsert = "*INVALID*"; break;
  32.         }
  33.  
  34.         sLeft += GetStringLeft(sRight, nPos) + "'" + SQLEncodeSpecialChars(sInsert) + "'";
  35.         sRight = GetStringRight(sRight, GetStringLength(sRight) - (nPos + 1));
  36.     }
  37.  
  38.     SetLocalString(GetModule(), "NWNX!ODBC!EXEC", sLeft + sRight);
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement