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
Related Article: Check if record exists using SP & return value if it does
is a solved ASP.NET discussion thread by while(!success) that has 6 replies, was last updated 5 months ago and has been tagged with the keywords: stored, procedure, return, value, check, if, record, exists, asp.net, c#, sql, server.
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
© 2013 DaniWeb® LLC
Page rendered in 0.0997 seconds
using 2.71MB