Problem in displaying returned value from function

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2006
Posts: 13
Reputation: Gowrishankar is an unknown quantity at this point 
Solved Threads: 1
Gowrishankar Gowrishankar is offline Offline
Newbie Poster

Problem in displaying returned value from function

 
0
  #1
Jun 27th, 2006
Hi,I am having problem in displaying the returned value from one function.I write one function for creating db connection,in that function I returned the string value of username.I want to display the string username value in different label through a button click event.What is the C# ASP.NET syntax ?Can any one help me..?Thanks.......
Last edited by Gowrishankar; Jun 27th, 2006 at 10:01 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 483
Reputation: campkev is an unknown quantity at this point 
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: Problem in displaying returned value from function

 
0
  #2
Jun 27th, 2006
LabelName.Text = StringName;
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 13
Reputation: Gowrishankar is an unknown quantity at this point 
Solved Threads: 1
Gowrishankar Gowrishankar is offline Offline
Newbie Poster

Re: Problem in displaying returned value from function

 
0
  #3
Jun 27th, 2006
Hi,You gave one syntax know,that is not working, Again I have some error...So,I discribed my problem here again ....
In that function I return one string value,I want to display the string value in another project by calling the dll of this.How can I display..?
Could you tell the code is correct or not for creating the db connection ?

publicstring FuncAuthentication(string txtusername)
{
string conn ="server=IDC-DEVELOPMENT ;uid=sa;pwd=password;database=SCBNotis";
string comm = "Select ADMINUSERID from ADMIN where ADMINUSERID='admin'";
SqlDataAdapter da =new SqlDataAdapter(comm,conn);
DataSet ds = new DataSet();
da.Fill(ds,"ADMIN");
DataTable dt = ds.Tables[0];
DataView dv;
dv = ds.Tables[0].DefaultView;
foreach(DataRow dr in dt.Rows)
{
txtusername=(dr [ "ADMINUSERID" ].ToString ( ));
}
return txtusername.ToString();
}
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 483
Reputation: campkev is an unknown quantity at this point 
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: Problem in displaying returned value from function

 
0
  #4
Jun 27th, 2006
here, let me clean up your code so that it more cleanly does what you have it doing now
  1. publicstring FuncAuthentication(string txtusername)
  2. {
  3. return "admin";
  4. }
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 13
Reputation: Gowrishankar is an unknown quantity at this point 
Solved Threads: 1
Gowrishankar Gowrishankar is offline Offline
Newbie Poster

Re: Problem in displaying returned value from function

 
0
  #5
Jun 28th, 2006
Hey,I want to get from the db not direct return.Hope you will have the ans...
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 483
Reputation: campkev is an unknown quantity at this point 
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: Problem in displaying returned value from function

 
0
  #6
Jun 28th, 2006
you're missing the point, which is that you're sql query isn't going to work.
It is always going to return either null or "admin"
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 2362 | Replies: 5
Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC