Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在搜索函数c中获取用户的特定ID#_C#_Asp.net - Fatal编程技术网

C# 在搜索函数c中获取用户的特定ID#

C# 在搜索函数c中获取用户的特定ID#,c#,asp.net,C#,Asp.net,我试过这个。但它只返回最后一个患者ID。我想获取第一个患者ID,但并不完全清楚您想要获取什么,但根据您在循环中设置的Session[“PatientID”],这将导致将此Session变量设置为最后一个PatientID,因为之前的设置值被覆盖。Hi。你能编辑你的问题并添加更多关于你想要什么的细节吗。你的标题上写着具体的id,你的问题是关于第一个和最后一个id以及某种返回。在代码中看不到任何返回。您只需重复(可能)搜索结果。 foreach (uspSearchPatient pat in se

我试过这个。但它只返回最后一个患者ID。我想获取第一个患者ID,但并不完全清楚您想要获取什么,但根据您在循环中设置的
Session[“PatientID”]
,这将导致将此Session变量设置为最后一个PatientID,因为之前的设置值被覆盖。

Hi。你能编辑你的问题并添加更多关于你想要什么的细节吗。你的标题上写着具体的id,你的问题是关于第一个和最后一个id以及某种返回。在代码中看不到任何返回。您只需重复(可能)搜索结果。
foreach (uspSearchPatient pat in search)
{
    HyperLink ViewProfile = new HyperLink();
    TableCell patient = new TableCell();
    TableCell profile = new TableCell();
    TableRow trPatient = new TableRow();

    ViewProfile.Text = "View Profile";
    ViewProfile.ID = pat.PatientID;
    Session["PatientID"] = pat.PatientID;
    ViewProfile.NavigateUrl = "ViewProfileByDoctor.aspx";
    profile.Controls.Add(ViewProfile);
    patient.Text = pat.Patient +"("+ pat.PatientID +")";
    trPatient.Cells.Add(patient);
    trPatient.Cells.Add(profile);

    tbSearchResults.Rows.Add(trPatient);             
}