最新国产好看的视频,伊人天堂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)論

绥化市| 瑞丽市| 芷江| 岢岚县| 文登市| 开远市| 寿阳县| 承德市| 普兰店市| 万宁市| 延长县| 称多县| 新龙县| 屏南县| 瑞金市| 浦城县| 昌黎县| 县级市| 大化| 合川市| 邹城市| 天等县| 二连浩特市| 华亭县| 祥云县| 阿拉善左旗| 周宁县| 麟游县| 望城县| 调兵山市| 三穗县| 四子王旗| 申扎县| 翼城县| 泸溪县| 津南区| 宝山区| 桑植县| 乌审旗| 淄博市| 唐河县|