Error 26 'dbcon.ohh(string)': not all code paths return a value
public int ohh(String query) { int c; try { MAconn = new SqlConnection(); MAconn.ConnectionString = connectionString; MAconn.Open(); MAcmd = MAconn.CreateCommand(); MAcmd.CommandText = query; c =(int)MAcmd.ExecuteScalar(); MAconn.Close(); return c; }
<pre>string query= "Select Count(*) FROM roles inner join users on roles.UserID=users.UserID inner join groups on roles.GroupID =groups.GroupID where username ='" + txtusername.Text + "' AND RoleName = '" + DropDownList1.Text + "'"; int count = obj.ohh(query); if (count > 0) { Label1.Text = "record exits"; } else { string query = "INSERT INTO ROLES (UserId,GroupId) SELECT UserId,GroupId FROM Users, Groups WHERE username= '" + txtusername.Text + "' AND RoleName='" + DropDownList1.Text + "'"; bool b=obj.UDI(query); if (b) { lblresult.Text = "Inserted"; //Response.Redirect("Products.aspx"); } else { lblresult.Text = "Not Inserted"; }
ohh
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)