We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,619 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Error: not all code paths return a value, anyone give me solution for this

public string generateEmployeeid()*//here i am getting this error  'objdataclassname.generateEmployeeid()'.' not all code paths return a value'*
{       
objDataBaseClass = new DataBaseClass();
if (Designation == "Student")
{
int id;
int count = 01;
string typ = "SID-";
objDataBaseClass = new DataBaseClass();
Table = objDataBaseClass.GetDataTable("spGetEmployeeID");// passing storerprocedure name
if (Table.Rows.Count > 0)
{
DataRow Row = Table.Rows[0];
id = int.Parse(Row[0].ToString());
returnString = typ + (count + id).ToString();
}
return returnString;
} }  // i need to generate Userid for different users
4
Contributors
3
Replies
2 Weeks
Discussion Span
2 Months Ago
Last Updated
7
Views
raajsj
Newbie Poster
8 posts since Feb 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

there is no return value when designation does not equal student

jstfsklh211
Junior Poster
100 posts since Apr 2011
Reputation Points: 34
Solved Threads: 27
Skill Endorsements: 1

You need a return value between the two curley brackets on line 18, like mentioned above.

ggamble
Light Poster
49 posts since Mar 2006
Reputation Points: 11
Solved Threads: 5
Skill Endorsements: 2

try to declare the returnString at the top of your code.. after the method.. and specify the datatype..

cyberdaemon
Junior Poster
125 posts since Nov 2010
Reputation Points: 11
Solved Threads: 2
Skill Endorsements: 0

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0997 seconds using 2.71MB