当前位置: 首页>>代码示例>>C#>>正文


C# Sql.exec方法代码示例

本文整理汇总了C#中Sql.exec方法的典型用法代码示例。如果您正苦于以下问题:C# Sql.exec方法的具体用法?C# Sql.exec怎么用?C# Sql.exec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sql的用法示例。


在下文中一共展示了Sql.exec方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: exec

        public void exec(string strConn)
        {
            Sql sql = new Sql(strConn);

            //リソースファイルにあるデータベース初期化SQLを取得
            string strCommand = Properties.Resources.InitSQL;

            sql.exec(strCommand);
        }
开发者ID:cestcaquejm,项目名称:LittleTree,代码行数:9,代码来源:InitDatabase.cs

示例2: modify

        private void modify()
        {
            string strModifyId;

            while (true)
            {
                Console.Write("Which category do you want to modify? : ");
                strModifyId = Console.ReadLine();

                if (strModifyId == "\t")
                {
                    list();
                    continue;
                }

                break;
            }

            string strTarget = find(strModifyId);

            string strModifyName;
            Console.Write(string.Format("'{0}' modify to : ", strTarget));
            strModifyName = Console.ReadLine();

            string strCommand = string.Format("update SubCategory set SubCategoryName='{0}' where SubCategoryId = {1};", strModifyName, strModifyId);

            Sql sql = new Sql(_strConn);
            sql.exec(strCommand);

            Console.WriteLine("Category '{0}' was modified to '{1}'", strTarget, strModifyName);
        }
开发者ID:cestcaquejm,项目名称:LittleTree,代码行数:31,代码来源:Category.cs

示例3: delete

        private void delete()
        {
            string strDeleteId;

            while (true)
            {
                Console.Write("Which category do you want to delete? : ");
                strDeleteId = Console.ReadLine();

                if (strDeleteId == "\t")
                {
                    list();
                    continue;
                }

                break;
            }

            string strConfirm;
            string strTarget = find(strDeleteId);

            Console.Write(string.Format("Do you really want to delete '{0}'? (y/n) : ", strTarget));
            strConfirm = Console.ReadLine();

            if (strConfirm == "y")
            {
                string strCommand = string.Format("update SubCategory set Active = 'N' where SubCategoryId = {0};", strDeleteId);

                Sql sql = new Sql(_strConn);
                sql.exec(strCommand);

                Console.WriteLine("Category '{0}' was deleted.", strTarget);
            }
            else
            {
                Console.WriteLine("Delete action was cancelled.");
            }
        }
开发者ID:cestcaquejm,项目名称:LittleTree,代码行数:38,代码来源:Category.cs

示例4: add

        private void add()
        {
            string strMainCatId;

            while (true)
            {
                Console.Write("Enter main category id : ");
                strMainCatId = Console.ReadLine();

                if (strMainCatId == "\t")
                {
                    listMain();
                    continue;
                }

                break;
            }

            string strAddCatName;
            Console.Write("Enter new category name : ");
            strAddCatName = Console.ReadLine();

            string strCommand;
            strCommand = string.Format("insert into SubCategory (MainCategoryId,SubCategoryName) values ({0},'{1}')", strMainCatId,strAddCatName);

            Sql sql = new Sql(_strConn);
            sql.exec(strCommand);

            Console.WriteLine(string.Format("New category '{0}' was added.",strAddCatName));
        }
开发者ID:cestcaquejm,项目名称:LittleTree,代码行数:30,代码来源:Category.cs

示例5: add


//.........这里部分代码省略.........
                _SubCategoryId = Console.ReadLine();
                switch (_SubCategoryId)
                {
                    case "\t":
                        Category ctg = new Category(_strConn);
                        ctg.list();
                        continue;
                    case "":
                        //Noneを選択
                        _SubCategoryId = "1";
                        break;
                    case "x":
                        return;
                    default:
                        break;
                }

                break;
            }

            while (true)
            {
                Console.Write("Input Amount : ");
                _Amount = Console.ReadLine();

                //Expenseの場合に符号を逆転
                if (strMode =="e")
                {
                    _Amount = "-" + _Amount;
                }

                try
                {
                    Convert.ToDecimal(_Amount);
                }
                catch
                {
                    Console.WriteLine("Inputed was not decimal number. \n");
                    continue;
                }

                break;
            }

            while (true)
            {

                Console.Write("Input DenomiId : ");
                _DenomiId = Console.ReadLine();

                Denomination dnm = new Denomination(_strConn);

                switch (_DenomiId)
                {
                    case "\t":
                        dnm.list();
                        continue;
                    case "x":
                        return;
                    case "":
                        Console.WriteLine("Input valid DenomiId");
                        continue;
                    default:
                        break;
                }

                if (dnm.find(_DenomiId) == "")
                {
                    Console.WriteLine(_DenomiId + " is not valid.");
                    continue;
                }

                break;
            }

            Console.Write("Input Memo (Optional) : ");
            _Memo = Console.ReadLine();

            string strCommand;
            strCommand = string.Format(@"
                insert into GeneralTrans(
                    TransDate
                ,   MainCategoryId
                ,   SubCategoryId
                ,   Amount
                ,   DenomiId
                ,   Memo)
                values(
                    '{0}'     #TransDate
                ,   {1}     #MainCategoryId
                ,   {2}     #SubCategoryId
                ,   {3}     #Amount
                ,   {4}     #DenomiId
                ,   '{5}'     #Memo
                )
                ", _TransDate, _MainCategoryId, _SubCategoryId, _Amount, _DenomiId, _Memo);

            Sql sql = new Sql(_strConn);
            sql.exec(strCommand);
        }
开发者ID:cestcaquejm,项目名称:LittleTree,代码行数:101,代码来源:Transaction.cs


注:本文中的Sql.exec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。