public DataSet exeSelectNSql(String[,] sqlStrTable)
{
int i, strLen;
strLen = sqlStrTable.Length / 2; //这句什么意思??
for (i = 0; i < strLen; i++)
{
.........
}
}
{
int i, strLen;
strLen = sqlStrTable.Length / 2; //这句什么意思??
for (i = 0; i < strLen; i++)
{
.........
}
}
解决方案 »
- 探索 ASP.NET MVC4 Developer Preview
- 如何有效率的实现线程阻塞
- 有什么方法可以修改dll文件,用reflector导出修改后还能编译回去吗?
- 估计没人能够解决的问题!
- c#视频远程传送如何实现?
- 关于文件打包的问题
- "对COM 组件的调用返回了错误HRESULT E_FAIL",在枚举OPC服务器时候出现这个错误提示
- 有关asp.net的
- 各位大哥, 谁有这本书 Pro NET 2.0 Windows Forms and Custom Controls in C#?
- C# DataGrid如何取得数据变更的那一列?
- 请资深高手解决,请教OracleClient连接的问题!急!急!
- 请问如何在不刷新页面情况下可以显示新绑定的数据?
public DataSet exeSelectNSql(String[,] sqlStrTable)
{
int i, strLen;
strLen = sqlStrTable.Length / 2;
DataSet myDs = new DataSet();
this.Adapter = new SqlDataAdapter();
for (i = 0; i < strLen; i++)
{
this.myCommand = new SqlCommand(sqlStrTable[i, 0], this.myConn);
this.myConn.Open();
this.Adapter.SelectCommand = this.myCommand; try
{ this.Adapter.Fill(myDs, sqlStrTable[i, 1]);
}
catch (SqlException)
{
this.myConn.Close();
this.myCommand.Dispose();
this.myCommand = null;
return null;
}
catch (ArgumentException)
{
this.myConn.Close();
this.myCommand.Dispose();
this.myCommand = null;
return null;
}
this.myConn.Close();
this.myCommand.Dispose();
this.myCommand = null;
}
return myDs;
}
这个方法是干什么用的?
for (i = 0; i < strLen; i++)
{
.........
}
省略的代码是什么?
最好把整个方法都给出来。
strLen = sqlStrTable.Length / 2; //这句什么意思??sqlStrTable 是外部传递进来的一个数组,.Length 长度属性就是把数组的一半长度赋值给整型变量strLen这是一般语法
是个2维数组吧?其长度就是他里面得元素个数吧?
我已经贴出来了啊,你看你得帖子上头
传进来的是是个二维数组
[0]是要sql语句,[1]是表名
string[,] mat = new string[n,2]
{
{"select * from table1","table1"},
{"select * from table2","table2"},
...
{"select * from tablen","tablen"},
};
所以循环的时候只需要循环mat.Length/2也就是n*2/2=n就够了,不知道有没有表达清楚。