zoukankan      html  css  js  c++  java
  • 测试数组元素变更

                SqlCommand cmd;
                SqlCommand[] cmds, cmds1;
                cmds=new SqlCommand[10];
                cmds1=new SqlCommand[10];
                for (int i = 0; i < 10; i++)
                {
                    cmd = new SqlCommand("select * from dbo.table" + i.ToString());
                    cmds[i] = cmd;
                    cmd=new SqlCommand("select * from hr.table"+i.ToString());
                    cmds1[i] = cmd;
                }
    
                Console.WriteLine("打印cmds");
                for (int i = 0; i < 10; i++)
                {
                    Console.WriteLine("cmds"+i.ToString()+":"+cmds[i].CommandText.ToString());
                }
                Console.WriteLine("打印cmds1");
                for (int i = 0; i < 10; i++)
                {
                    Console.WriteLine("cmds1" + i.ToString() + ":" + cmds1[i].CommandText.ToString());
                }
                Console.WriteLine();
                Console.ReadKey();
    打印cmds
    cmds0:select * from dbo.table0
    cmds1:select * from dbo.table1
    cmds2:select * from dbo.table2
    cmds3:select * from dbo.table3
    cmds4:select * from dbo.table4
    cmds5:select * from dbo.table5
    cmds6:select * from dbo.table6
    cmds7:select * from dbo.table7
    cmds8:select * from dbo.table8
    cmds9:select * from dbo.table9
    打印cmds1
    cmds10:select * from hr.table0
    cmds11:select * from hr.table1
    cmds12:select * from hr.table2
    cmds13:select * from hr.table3
    cmds14:select * from hr.table4
    cmds15:select * from hr.table5
    cmds16:select * from hr.table6
    cmds17:select * from hr.table7
    cmds18:select * from hr.table8
    cmds19:select * from hr.table9
  • 相关阅读:
    Yii2 分页
    Yii2 或者当前登录用户帐号
    css3媒体查询判断移动设备横竖屏
    Javascript操作Tr隐藏显示变形~
    php注释标准
    匹配一段html中所有的src
    数据库遇到错误(随时补充)
    NetCore-缓存文件上传和文件流上传
    SVN跨服务器版本迁移
    发票同步微信卡包
  • 原文地址:https://www.cnblogs.com/dennys/p/3624842.html
Copyright © 2011-2022 走看看