我只有第一员工的详细信息. [英] only First Employee details i got it.

查看:90
本文介绍了我只有第一员工的详细信息.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行我的程序时.我只有第一位员工的详细信息.我选择第二个雇员而不是第二个雇员.只有第一位员工的详细信息会被检索.

如何在我的Web表单中获取选定的员工详细信息.

when i am run my program. only first employee details is i got it. i am select second employee not retrive the second employee. only first employee details is retrive it.

how i am got selected employee details in my web form.

protected void Page_Load(object sender, EventArgs e)
    {
        string connection = System.Configuration.ConfigurationManager.ConnectionStrings["aaa2"].ConnectionString;
        SqlConnection con = new SqlConnection(connection);
        con.Open();
        SqlCommand cmd = new SqlCommand("Select td_em_id from pa_tds_int_entry", con);
        SqlDataReader dr = cmd.ExecuteReader();
        ddlId.DataSource = dr;
        ddlId.DataTextField = "td_em_id";
        ddlId.DataBind();
        
    }

推荐答案

引用此链接

http://msdn.microsoft.com/en-us/library/haa3afyz (v = vs.71).aspx [
Refer This Link

http://msdn.microsoft.com/en-us/library/haa3afyz(v=vs.71).aspx[^]

Accept This Answer If It Has Helped You.


您好,

您可以根据自己的样品进行此操作

Hi,

You can do this based on your sample

string connection = System.Configuration.ConfigurationManager.ConnectionStrings["aaa2"].ConnectionString;
SqlConnection con = new SqlConnection(connection);
con.Open();
SqlCommand cmd = new SqlCommand("Select td_em_id from pa_tds_int_entry WHERE td_em_id = '" + ddlId.SelectedValue + "' ", con);
SqlDataReader dr = cmd.ExecuteReader();
ddlId.DataSource = dr;
ddlId.DataTextField = "td_em_id";
ddlId.DataBind();


希望这一点对您有所帮助.


I hope this one can help.


为DataReader对象使用while循环,
例如.
use while loop for DataReader object,
eg.
while(dr.Read())
{
foreach(int k in dr)
   {
          Console.WriteLine(dr[k]);
   }
}





您将得到输出...祝您好运..





you will get your output...good luck..


这篇关于我只有第一员工的详细信息.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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