It is my function in order to add a row to a table but I don't know how to return the id of it (Thıs Column's name is Group_id)
public Boolean CreateGroup(string Group_Name, string Description, string category, string username)
{
Boolean res = false;
var sql = "INSERT INTO Group ( Group_Name, Description, User_Name) "
+ "VALUES ( @Group_Name, @Description, @User_Name )";
SqlCommand cmd = new SqlCommand(sql, Connect());
cmd.Parameters.Add("@Group_Name", SqlDbType.VarChar, 25).Value = Group_Name;
cmd.Parameters.Add("@User_Name", SqlDbType.VarChar, 15).Value = username;
cmd.Parameters.Add("@RSS_Description", SqlDbType.VarChar, 1500).Value = Description;
try
{
cmd.ExecuteNonQuery();
res = true;
closeConnection();
}
catch (Exception)
{
res = false;
}
return res;
}