Hi, can someone pls help me.
I'm trying to pass the name of the user who logs in from a login form and display his/her name on a Main form. I'm using get{} and set{}. My problem is with the function I'm trying to create to return the name of the user which I'm going to place inside my get{}. Here's my function (I've placed this within a Class):
public static string loggedinuser(TextBox uname,TextBox password)
{
readrecord("Select dbo.loggeduser('" + uname.Text + "','" + password.Text + "')");
if (dr.Read())
{
while (dr.Read())
{
string name =(dr[0].ToString());
return name;
}
}
con.Close();
}
It's showing this error "Not all code paths return a value." I don't understand. I already have the return statement.
If somebody can help me, I'm most grateful. Thanks so much in advance!