最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

asp.net ListView 數(shù)據(jù)綁定

 更新時(shí)間:2009年01月18日 05:34:41   作者:  
asp.net ListView 數(shù)據(jù)綁定 實(shí)現(xiàn)代碼
代碼如下:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
string strsql = @"server=.;uid=sa;pwd=sa;database=Northwind";
SqlConnection my_Conn = new SqlConnection(strsql);
my_Conn.Open();
string str_sql ="select * from employeesTable";
// DataSet my_Dataset = new DataSet();
// SqlCommand my_comm = new SqlCommand(str_sql, my_Conn);
// SqlDataAdapter sql_Adapter = new SqlDataAdapter(str_sql, my_Conn);
//sql_Adapter.Fill(my_Dataset,"employeesTable");
SqlCommand my_Comm = new SqlCommand(str_sql, my_Conn);
SqlDataReader reader = my_Comm.ExecuteReader();
while (reader.Read())
{
ListViewItem viewitem = new ListViewItem(reader[0].ToString());
viewitem.ImageIndex = 0;
viewitem.SubItems.Add(reader[1].ToString());
viewitem.SubItems.Add(reader[2].ToString());
listView1.Items.Add(viewitem);
}
}
private void BtnSearch_Click(object sender, EventArgs e)
{
int mystartindex = 0;///
int Count = Convert.ToInt32(this.textBox1.Text);
ListViewItem Item = listView1.FindItemWithText(textBox1.Text,true,mystartindex);
try
{
if (textBox1.Text != null)
// if (Count>=listView1.Items.Count)
{
listView1.Focus();
Item.Selected = true;
mystartindex = mystartindex + 1;
}
else
{
MessageBox.Show("沒(méi)有您要的數(shù)據(jù)");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}

相關(guān)文章

最新評(píng)論

潼南县| 元谋县| 永吉县| 南岸区| 杨浦区| 崇信县| 门源| 滦平县| 敖汉旗| 景泰县| 辉南县| 循化| 台安县| 黎城县| 册亨县| 德兴市| 天长市| 英超| 墨玉县| 桂平市| 鹿邑县| 科尔| 康马县| 汶川县| 柘荣县| 准格尔旗| 华亭县| 无为县| 卓尼县| 海口市| 天长市| 北海市| 鹿泉市| 荥阳市| 万宁市| 道真| 阿城市| 泸水县| 林甸县| 曲阜市| 北川|