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.......

LabelName.Text = StringName;

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 ?

public string 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();
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();

here, let me clean up your code so that it more cleanly does what you have it doing now

publicstring FuncAuthentication(string txtusername)
return "admin";

Hey,I want to get from the db not direct return.Hope you will have the ans...

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"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.