Hi all,anyone can help me to solve this error.When I build the code it shows the error message below:What I have to do ?
C:\Inetpub\wwwroot\shankar\WebApplication1\login.aspx.cs(83): 'WebApplication1.WebForm1.Custvaluserid_ServerValidate(object, System.Web.UI.WebControls.ServerValidateEventArgs)': not all code paths return a value
This is the code I written:
private bool Custvaluserid_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)
{
SqlConnection conn= new SqlConnection();
conn.ConnectionString="server= 'server name';uid=sa;pwd=;database=";
string query="select ADMINUSERID from ADMIN where ADMINUSERID='admin'";
SqlCommand comm=new SqlCommand(query,conn);
conn.Open();
SqlDataReader dr=comm.ExecuteReader();
args.IsValid = false;
while(dr.Read())
{
bool msg;
string txtuserid;
txtuserid=(dr [ "ADMINUSERID" ].ToString ( ));
if(txtuserid==args.Value)
{
args.IsValid = true;
msg=true;
return msg;
}
}
}