예제 #1
0
        private void InsertRecProc(string TblName, List <string> strFieldList, List <List <string> > strRecList)
        {
            if (strRecList.Count <= 0)
            {
                return;
            }

            ArrayList SqlCmdList = new ArrayList();

            for (int i = 0; i < strRecList.Count; i++)
            {
                string strSqlCmd = "Insert Into " + TblName + "(";

                for (int k = 0; k < strFieldList.Count - 1; k++)
                {
                    strSqlCmd += strFieldList[k] + ",";
                }
                strSqlCmd += strFieldList[strFieldList.Count - 1] + ") Values (";

                for (int k = 0; k < strFieldList.Count - 1; k++)
                {
                    strSqlCmd += "'" + strRecList[i][k].ToString() + "'" + ", ";
                }
                strSqlCmd += "'" + strRecList[i][strFieldList.Count - 1].ToString() + "')";

                SqlCmdList.Add(strSqlCmd);
            }

            TSqlDbClass.MultiSqlTranProc(TGlobalVar.sSqlConn, SqlCmdList);
        }