DataSet ds = new DataSet();strSql = "select * from table1";
mySqlAdapter = new SqlDataAdapter(strSQL,strSqlConn);
mySqlAdapter.Fill(ds,"table1");strSql = "select * from table2";
mySqlAdapter = new SqlDataAdapter(strSQL,strSqlConn);
mySqlAdapter.Fill(ds,"table2");
mySqlAdapter = new SqlDataAdapter(strSQL,strSqlConn);
mySqlAdapter.Fill(ds,"table1");strSql = "select * from table2";
mySqlAdapter = new SqlDataAdapter(strSQL,strSqlConn);
mySqlAdapter.Fill(ds,"table2");
解决方案 »
- 100分 寻找一种可以设置格式和编辑的文本组件
- “System.StackOverflowException”类型的未经处理的异常出现在 System.Data.dll 中
- 这样一个单选功能如何实现?貌似很难,多谢!
- 求<<ASP.NET项目开发实践>>,中国铁道出版社这本书带光盘中的源程序!
- cookie动态赋值,然后怎么动态获取cookie的值?
- sender,e代表的内容
- 哪位兄弟有HTTPHandler、HTTPModule和Castle的资料!!!
- 图片浏览程序的小问题
- jquery验证用户名是否存在的问题
- 请教关于多表查询sql语句问题?
- 我需要支持中文的.NET 压缩和解压组件,谁有请发给我好吗,谢谢了.
- 我想把服务器上的数据用DataSet写成XML保存到本地,可是出现无法写的问题,请帮忙。
mySqlAdapter.SelectCommand =new SqlCommand();
mySqlAdapter.SelectCommand.Connection =conn;strSql = "select * from table1";
mySqlAdapter.SelectCommand.CommandText =strSql ;
mySqlAdapter.Fill(ds,"table1");
strSql = "select * from table2";
mySqlAdapter.SelectCommand.CommandText =strSql
mySqlAdapter.Fill(ds,"table2");
{
string tableName = "Table";
for (int index=0; index < tableNames.Length; index++)
{
if( tableNames[index] == null || tableNames[index].Length == 0 ) throw new ArgumentException( "The tableNames parameter must contain a list of tables, a value was provided as null or empty string.", "tableNames" );
dataAdapter.TableMappings.Add(tableName, tableNames[index]);
tableName += (index + 1).ToString();
}
}
// Fill the DataSet using default values for DataTable names, etc
dataAdapter.Fill(dataSet);
你用fill(dataset), dataset里面就会有两个表