Delete forum's post error with sqlce db

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
12/14/2011 1:32:56 AM
Gravatar
Total Posts 46

Delete forum's post error with sqlce db

Hi. joe

when delete a post in a forum, error occurs.

error in mojoPortal.Features.Data.SqlCe\Forums\DBForum.cs

public static bool UpdateUserStats(int userId)
{
StringBuilder sqlCommand = new StringBuilder();
sqlCommand.Append("UPDATE mp_Users ");
sqlCommand.Append("SET ");
sqlCommand.Append("TotalPosts = (SELECT COUNT(*) FROM mp_ForumPosts WHERE mp_ForumPosts.UserID = mp_Users.UserID) ");
....

}

above bold sql is invalid in sqlce.

thanks!

version: 2.3.7.5

db: sqlce

os: windows 7

12/14/2011 7:02:23 AM
Gravatar
Total Posts 18439

Re: Delete forum's post error with sqlce db

Hi,

Thanks for the bug report.

I just implemented a fix and pushed it to the source code repository, but I have not tested it. Are you working from the source code repository? Can you pull the latest code and verify the fix?

Thanks,

Joe

12/14/2011 12:35:10 PM
Gravatar
Total Posts 46

Re: Delete forum's post error with sqlce db

Hi, joe

Delete a post is ok!

But if delete a form, error occurs.

/////////////////////////////////////////////////////////////////////////////////////////

public static bool UpdateUserStats(int userId)
{
if (userId > -1) //updating a single user
{
int postCount = UserGetUserPostCount(userId);
return UpdateSingleUserStats(userId, postCount);

}

StringBuilder sqlCommand = new StringBuilder();
sqlCommand.Append("SELECT ");
sqlCommand.Append("UserID, ");
sqlCommand.Append("COUNT(*) As Count ");
sqlCommand.Append("FROM mp_ForumPosts "); // Change to FROM mp_ForumPosts GROUP BY UserID will be ok!
sqlCommand.Append(";");

DataTable dataTable = new DataTable(); ;

using (IDataReader reader = SqlHelper.ExecuteReader(
GetConnectionString(),
CommandType.Text,
sqlCommand.ToString(),
null))
{
dataTable.Load(reader);
}

///////////////////////////////////////////////////////////

Above bold code errors!

Thanks!

12/14/2011 2:15:18 PM
Gravatar
Total Posts 18439

Re: Delete forum's post error with sqlce db

Thanks! This is now fixed in the source code repository.

Best,

Joe

12/15/2011 11:49:18 AM
Gravatar
Total Posts 46

Re: Delete forum's post error with sqlce db

Hi, joe

in sqlce's  DBModule.UpdatePage has the same problem.

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

public static bool UpdatePage(int oldPageId, int newPageId, int moduleId)
{
StringBuilder sqlCommand = new StringBuilder();
sqlCommand.Append("UPDATE mp_PageModules ");
sqlCommand.Append("SET ");
sqlCommand.Append("PageID = @NewPageID, ");
sqlCommand.Append("PageGuid = (SELECT TOP 1 PageGuid FROM mp_Pages WHERE PageID = @NewPageID) ");

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

when update a module's belong page, the error occurs!

Thanks!

12/15/2011 3:59:57 PM
Gravatar
Total Posts 18439

Re: Delete forum's post error with sqlce db

Thanks again! This is now fixed in the source code repository.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.