private string combineWhereQuery()
        {
            String strResult = null;
            int    nRow      = dataTable.Rows.Count;

            int nWhere = 0;

            foreach (DataRow dataRow in dataTable.Rows)
            {
                DataColumn dataColumn1 = dataTable.Columns[0];
                DataColumn dataColumn2 = dataTable.Columns[1];
                DataColumn dataColumn3 = dataTable.Columns[2];

                Console.WriteLine("====================================");
                Console.WriteLine(dataRow[dataColumn1].ToString());
                Console.WriteLine(dataRow[dataColumn2].ToString());
                Console.WriteLine(dataRow[dataColumn3].ToString());

                if (dataRow[dataColumn1].ToString() == null)
                {
                    continue;
                }

                if (dataRow[dataColumn2].ToString() == null)
                {
                    dataRow[dataColumn2] = "";
                }

                if (dataRow[dataColumn3].ToString() == null)
                {
                    continue;
                }



                //MessageBox.Show(grid[2, i].Value.ToString());

                if (!dataRow[dataColumn3].ToString().Equals("True"))
                {
                    continue;
                }

                nWhere++;

                string strAdd = " WHERE  ";

                if (nWhere > 1)
                {
                    strAdd = "   AND  ";
                }

                strResult += strAdd + makeQuery.makeWhereQuery(dataRow[dataColumn1].ToString()
                                                               , dataRow[dataColumn2].ToString());

                strResult += "\n";
            }

            return(strResult);
        }
Beispiel #2
0
        private string combineSelectQuery()
        {
            String strResult = null;

            int i = 0;

            foreach (DataRow dataRow in dataTable.Rows)
            {
                DataColumn filedColumn       = dataTable.Columns[0];
                DataColumn commentColumn     = dataTable.Columns[1];
                DataColumn whereFiledColumn  = dataTable.Columns[2];
                DataColumn operationedColumn = dataTable.Columns[3];
                string     seleted           = dataRow[operationedColumn].ToString();
                if (seleted.Equals("true", StringComparison.OrdinalIgnoreCase) == false)
                {
                    continue;
                }
                if (dataRow[filedColumn].ToString() == null)
                {
                    continue;
                }

                if (dataRow[commentColumn].ToString() == null)
                {
                    dataRow[commentColumn] = "";
                }

                string strAdd = "   SET  ";

                if (i != 0)
                {
                    strAdd = "     ,  ";
                }

                string filed   = dataRow[filedColumn].ToString();
                string comment = dataRow[commentColumn].ToString();
                strResult += strAdd + makeQuery.makeWhereQuery(filed, comment);

                strResult += "\n";
                i++;
            }

            return(strResult);
        }
Beispiel #3
0
        private string combineWhereQuery()
        {
            String strResult = null;
            int    nRow      = dataTable.Rows.Count;

            int nWhere = 0;

            foreach (DataRow dataRow in dataTable.Rows)
            {
                DataColumn filedColumn      = dataTable.Columns[0];
                DataColumn commentColumn    = dataTable.Columns[1];
                DataColumn whereFiledColumn = dataTable.Columns[2];

                if (dataRow[filedColumn].ToString() == null)
                {
                    continue;
                }

                if (dataRow[commentColumn].ToString() == null)
                {
                    dataRow[commentColumn] = "";
                }

                if (dataRow[whereFiledColumn].ToString() == null)
                {
                    continue;
                }

                if (!dataRow[whereFiledColumn].ToString().Equals("True"))
                {
                    continue;
                }

                nWhere++;

                string strAdd = " WHERE  ";

                if (nWhere > 1)
                {
                    strAdd = "   AND  ";
                }
                string filed   = dataRow[filedColumn].ToString();
                string comment = dataRow[commentColumn].ToString();
                strResult += strAdd + makeQuery.makeWhereQuery(filed, comment);


                strResult += "\n";
            }

            return(strResult);
        }
Beispiel #4
0
        private string combineWhereQuery()
        {
            String strResult = null;

            int i = 0;

            foreach (DataRow dataRow in dataTable.Rows)
            {
                DataColumn dataColumn1 = dataTable.Columns[0];
                DataColumn dataColumn2 = dataTable.Columns[1];
                DataColumn dataColumn3 = dataTable.Columns[2];


                if (dataRow[dataColumn1].ToString() == null)
                {
                    continue;
                }

                if (dataRow[dataColumn2].ToString() == null)
                {
                    dataRow[dataColumn2] = "";
                }

                string strAdd = "        ";

                if (i != 0)
                {
                    strAdd = "     ,  ";
                }

                strResult += strAdd + makeQuery.makeWhereQuery(
                    dataRow[dataColumn1].ToString(), dataRow[dataColumn2].ToString());

                strResult += "\n";
                i++;
            }

            return(strResult);
        }