示例#1
0
        void ReadCfg(string CfgPath)
        {
            FileStream   fs = null;
            StreamReader sr = null;

            try
            {
                string ReakCfgPath = FunCommon.GetDir() + "/Config/SearchBoxCtrler/" + CfgPath + ".cfg";

                fs = new FileStream(ReakCfgPath, FileMode.Open);
                sr = new  StreamReader(fs, Encoding.Default);
                string Realte = sr.ReadLine();

                SearchColumns = FunCommon.CutToArry(Realte, ',');

                sr.Close();
                fs.Close();
            }
            catch
            {
                if (fs != null)
                {
                    fs.Close();
                }
                if (sr != null)
                {
                    sr.Close();
                }
            }
        }
示例#2
0
        public static string CreateJson(string columns, object[] values)
        {
            try
            {
                string   JsonStr = "{";
                string[] c       = FunCommon.CutToArry(columns, ',');
                for (int i = 0; i < c.Length; i++)
                {
                    if (i < values.Length)
                    {
                        JsonStr += "\"" + c[i] + "\":\"" + values[i].ToString() + "\",";
                    }
                    else
                    {
                        JsonStr += "\"" + c[i] + "\":\"" + "" + "\",";
                    }
                }

                if (JsonStr.Length > 1)
                {
                    JsonStr = JsonStr.Remove(JsonStr.Length - 1);
                }

                JsonStr += "}";

                return(JsonStr);
            }
            catch
            {
                return(null);
            }
        }
示例#3
0
        public static void Update(string Table, int ID, string Column, object[] Values)
        {
            string SqlStr = "update " + Table + " set ";

            string[] columns = FunCommon.CutToArry(Column, ',');
            for (int i = 0; i < columns.Length; i++)
            {
                SqlStr += columns[i] + " = '" + Values[i] + "',";
            }
            SqlStr  = SqlStr.Remove(SqlStr.Length - 1);
            SqlStr += " Where ID = '" + ID + "'";

            Exec(SqlStr);
        }