zoukankan
html css js c++ java
Hashtable与DataTable,ArrayList的简单应用(转自cnblogs)
1
public
void
InitData()
2
{
3
string
sql
=
@"
select * from orders
"
;
4
5
SqlConnection con
=
new
SqlConnection(
"
server=.;uid=sa;pwd=sa;database=NorthWind
"
);
6
SqlDataAdapter sda
=
new
SqlDataAdapter(sql, con);
7
DataTable dt
=
new
DataTable();
8
sda.Fill(dt);
9
10
Hashtable htt
=
new
Hashtable(
5
);
11
12
foreach
(DataRow dr
in
dt.Rows)
13
{
14
htt.Add(dr[
"
orderID
"
], dr[
"
CustomerID
"
]);
15
16
}
ArrayList al = new ArrayList(htt.Values);
al.Sort();
for (int i = 0; i < al.Count; i++)
{
//if (al[i].ToString() =="VINET")
//{
// Response.Write(al[i].ToString());
//}
Response.Write(al[i].ToString());
}
19
foreach
(DictionaryEntry de
in
htt)
20
{
21
if
(de.Value.ToString
==
"
ALFKI
"
)
22
{
23
Response.Write(de.Key
+
"
Next
.
"
);
24
}
25
}
26
GridView1.DataSource
=
dt;
27
GridView1.DataBind();
28
29
}
查看全文
相关阅读:
(转).NET Compact Framework使用P/Invoke服务
C#编码好习惯
有些东西必须时刻放在心上!
我是这样的人吗?是!!!!!!!!!
经济学家张五常教大家四招读书的方法 (转)
#在宏中的某些用法(转)
牛人太强了,我该怎么努力呀?
利用增强限制条件来求解问题
努力呀!即将面临的deadline
volume visualization reserach时刻记在心的要点
原文地址:https://www.cnblogs.com/xiaobaigang/p/857672.html
最新文章
关于AutoCompleteTextView 为什么必须输入两个字符才能出现补全提示的问题的解决办法
Google Play服务和OAuth认证工具
关于AutoCompleteTextView 为什么必须输入两个字符才能出现补全提示的问题的解决办法
Android开发之精仿QQ设置界面(自定义PreferenceActivity)
android自定义Spinner下拉菜单和AutoCompleteTextView自动显示的(下拉列表框)样式
android自定义Spinner下拉菜单和AutoCompleteTextView自动显示的(下拉列表框)样式
把“hello”打印10次
常见Java面试题:重载(overloading)与重写(overriding)
Android动画分析之3D翻转效果
Android动画分析之3D翻转效果
热门文章
sql语句查询重复的数据
6月上旬项目小结
windows应用程序配置log4net日志记录
获取共享程序集DLL小技巧
上传文件,另存为物理文件方法
让方法返回多个参数
ppc关闭窗体的问题
资本永远有回报 一天存1元60年后可达200万
c#中使用多线程访问winform中控件的问题
mobile Socket连接PC 的类
Copyright © 2011-2022 走看看