YAFLogo

simongh
  • simongh
  • 51.8% (Neutral)
  • YAF Forumling Topic Starter
13 years ago
I'm hoping someone might be able to help me out.

I've just installed a new installation of YAF on a IIS7 machine. I'm using a SQL2008 server for the DB. I've set the DatabaseOwner to yaf & set the DatabaseObjectQualifier to "" so that all the db objects sit nicely in the schema I've created on the DB. The account I connect with has at the moment dbo access on the db.

My problem is I can't login or create a new account. When I create a new account, I see the following error in the DB. Any idea what's causing this? I looked through the source code & can't see why it would have an issue. My next step looks like it's going to be debugging the code which I didn't really want to do, not yet anyway.

System.Data.SqlClient.SqlException (0x80131904): Incorrect syntax near the keyword 'User'.

at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)

at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()

at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)

at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData()

at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)

at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)

at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)

at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)

at System.Data.SqlClient.SqlCommand.ExecuteScalar() at YAF.Classes.Data.MsSqlDbAccess.ExecuteScalar(IDbCommand cmd, Boolean transaction)

at YAF.Types.Interfaces.IDbAccessExtensions.ExecuteScalar(IDbAccess dbAccess, IDbCommand cmd)

at YAF.Classes.Data.LegacyDb.user_get(Int32 boardID, Object providerUserKey)

at YAF.Core.UserMembershipHelper.GetUserIDFromProviderUserKey(Object providerUserKey)

at YAF.Core.RoleMembershipHelper.UpdateForumUser(MembershipUser user, Int32 pageBoardID)

at YAF.Core.UserPageBase.InitUserAndPage()

Sponsor
simongh
  • simongh
  • 51.8% (Neutral)
  • YAF Forumling Topic Starter
13 years ago
So I tracked it down. There's a table called User. User is a reserved word & SQL2008 won't let you use it as is. Put [] round it, everything works fine (so far).

Simon

squirrel
13 years ago

So I tracked it down. There's a table called User. User is a reserved word & SQL2008 won't let you use it as is. Put [] round it, everything works fine (so far).

Simon

Originally Posted by: simongh 

This error is happening because you removed the 'Database Object Qualifier" on the table names, this eliminating the default yaf_ from the table names. This leaves tables with names like "User". you will find this may create more problems down the line. It is recommended you have atleast some form of "Database Object Qualifier" in place (such as forum_ or yaf_ (default)) to help YAF keep it's tables seperate from other applications on the server...


If you can't find it using the forum search, try my signature link -- searches this site using Google: Google is my Friend 
simongh
  • simongh
  • 51.8% (Neutral)
  • YAF Forumling Topic Starter
13 years ago
I understand what you're saying and used the same naming scheme for our database objects. However SQL 2005 & later added schemas which is stronger method of achieving the same.

There's only 3 references in the code to the user table, so I've fixed & built my own version from the source code.

Simon