how to catch return values seperately

Posted by Naseer under ASP.NET on 1/10/2013 | Points: 10 | Views : 893 | Status : [Member] | Replies : 1
hi,

i am doing a search application in that i want to retrieve the data from the database,data means username and userid ,if i binded username its bonding to textbox,my requirement is i have to take userid also along with username but only username have to bind to textbox and userid have to use in someother place,
how can i get,

code:


public List<string[]> GetUsers(string SearchText)
{

List<string[]> result = new List<string[]>();

clsGlobal objglobal = new clsGlobal();
DataSet dsUsername;


dsUsername = objglobal.search(Session["RoomID"].ToString(), SearchText);



foreach (DataRow dRow in dsUsername.Tables[0].Rows)
{
string[] str = new string[2];
str[0] = dRow["Username"].ToString();
str[1] = dRow["UserID"].ToString();
result.Add(str);
}

return result;
}


Thanks in advance,
Naseer




Responses

Posted by: muralikrishnasurap-12704 on: 1/10/2013 [Member] Starter | Points: 25

Up
0
Down
Hi Naseer

Try this..
var stringarray = GetUsers(PassurStringvalue);
Console.WriteLine(stringarray[0].ElementAt(0));//userName bined to textbox
Console.WriteLine(stringarray[0].ElementAt(1));//userId

Console.Read();

Best Regards
Murali Krishna.S

Naseer, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response