| | |
Problem in displaying returned value from function
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jun 2006
Posts: 13
Reputation:
Solved Threads: 1
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.
•
•
Join Date: Jun 2006
Posts: 13
Reputation:
Solved Threads: 1
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();
}
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();
}
•
•
Join Date: Jul 2005
Posts: 483
Reputation:
Solved Threads: 19
here, let me clean up your code so that it more cleanly does what you have it doing now
C# Syntax (Toggle Plain Text)
publicstring FuncAuthentication(string txtusername) { return "admin"; }
![]() |
Similar Threads
- Problem with string variable in void prnt function (C++)
- AnsiString Template Data Return Problem Builder 6 (C++)
Other Threads in the C# Forum
- Previous Thread: New to C#. GDI driving me crazy!
- Next Thread: SQLCommandBuilder is Dumb?
Views: 2362 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for C#
.net access ado.net algorithm array barchart bitmap broadcast button buttons c# check checkbox class client code color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing event excel file files form format forms ftp function gdi+ http httpwebrequest image index input install java label list listbox listener login mandelbrot math mouseclick mysql networking object operator path picturebox pixelinversion post prime programming radians regex remote remoting resource richtextbox save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml





