使用while循环如何在oledb连接中使用多个表 [英] using while loop how to use mutiple table in oledb connection

查看:55
本文介绍了使用while循环如何在oledb连接中使用多个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用while循环如何使用oledb连接在ms访问数据库中使用多个表。



为此发送一个示例,



请帮帮我。



问候,



Narasiman P.



注意它是windows应用程序。

解决方案

你可以使用加入查询或

表示数据集中的多个结果集



表示例如

 sqlcommand cmd =  new  sqlcommand(  select * from table1; select * from table2,CNN); 

sqldataadapter da = new sqldataadapter();

da.selectcommand = cmd;

数据集ds = 数据集();
da.fill(ds);

// 访问第一个表,你可以写

ds.tables [ 0 ]。行[ 0 ] [ 0 ]的toString;

// 访问2ndtable,你可以写

ds.tables [ 1 ]。行[ 0 ] [ 0 ]的toString;


using while loop how to use multiple table in ms access database using oledb connetion.

for that send one example,

Please help me.

Regards,

Narasiman P.

Note it is windows application.

解决方案

you can use join query or
for multiple result set in dataset

for ex.

sqlcommand cmd = new sqlcommand("select * from table1;select * from table2",cnn);

sqldataadapter da = new sqldataadapter();

da.selectcommand=cmd;

dataset ds= new dataset();
da.fill(ds);

//to access 1st table you can write

ds.tables[0].rows[0][0].tostring;

//to access 2ndtable you can write

ds.tables[1].rows[0][0].tostring;


这篇关于使用while循环如何在oledb连接中使用多个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆