Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Localization/Multi-language business objects
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Localization/Multi-language business objects
Environment versions
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01132132
Message ID:
01132132
Views:
63
I am trying to use the multi-language features of MM.Net. Because of the limits in FoxPro, I am subclassing the message manager to change the name of the messagetextfield and overriding the GetMessageCmd to reflect the field name change. I also changed the factory code, as indicated in the help file. The program does not seem to be picking up my overrides. What am I missing? My code and the full error message are below.

Thanks.

Linda


I created a new class called MessageManager with the following code:
    /// <summary>
    /// Summary description for MessageManager.
    /// </summary>
    public class MessageManager : mmMessageManager
    {
        /// <summary>
        /// Constructor
        /// </summary>
        public MessageManager()
        {
            this.TableName = "Message";
            this.PrimaryKey = "MessagePK";
            this.DescriptionField = "MessageTxt";
            this.MessageKeyField = "MessagePK";
            this.MessageTextField = "MessageTxt";
        }
        /// <summary>
        /// Returns a list of all messages for a specific language.
        /// </summary>
        /// <param name="languagePK"></param>
        /// <returns></returns>
        public override DataTable GetAllMessages(object languagePK)
        {
            mmDataAccessBase dao = this.GetDataAccessObject();
            IDbDataParameter param =
                dao.CreateParameter(dao.ParameterPrefixChar + "LanguagePk", languagePK);
            param.DbType = this.LanguageFieldType;
            DataSet dsMessages = this.GetDataSet("select MessageKey,MessageTxt,DialogText from " +
                dao.TableNameDelimitBegin + this.TableName + dao.TableNameDelimitEnd
                + " where " +
                this.LanguageField + " = " + dao.ParameterPrefixChar + "LanguagePk", "TMessages", param);
            if (dsMessages == null)
                return null;

            return dsMessages.Tables[0];
        }

    }
I then changed the Factory.cs file to include:
    public override mmMessageManager CreateMessageManager()
    {
        return new mmMessageManager();
    }
When I run the program I get an OLEDB error that it cannot find the field MessageText, which is the field name I have changed. The full stack trace of the error is:

OleDbException (0x80004005): SQL: Column 'MESSAGETEXT' is not found.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) +65
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +181
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +307
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +77
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +188
System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) +122
System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +29
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +183
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +308
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +152
OakLeaf.MM.Main.Data.mmDataAccessOleDb.FillDataSet(DataSet ds, IDbDataAdapter dbAdapter, String tableName, Boolean clearOnFill) +445
OakLeaf.MM.Main.Data.mmDataAccessOleDb.FillDataSet(DataSet ds, IDbCommand command, String tableName, Boolean clearOnFill) +111
OakLeaf.MM.Main.Data.mmDataAccessOleDb.FillDataSet(DataSet ds, String command, String tableName, CommandType cmdType, IDbDataParameter[] dataParms, Boolean clearOnFill) +246
OakLeaf.MM.Main.Business.mmBusinessObject.FillDataSet(DataSet ds, String command, String tableName, String databaseKey, CommandType cmdType, IDbDataParameter[] dataParams) +379
OakLeaf.MM.Main.Business.mmBusinessObject.GetDataSet(String command, String tableName, String databaseKey, CommandType cmdType, IDbDataParameter[] dataParams) +86
OakLeaf.MM.Main.Business.mmBusinessObject.GetDataSet(String command, String tableName, String databaseKey, IDbDataParameter[] dataParams) +94
OakLeaf.MM.Main.Business.mmBusinessObject.GetDataSet(String command, String tableName, IDbDataParameter[] dataParams) +87
OakLeaf.MM.Main.Globalization.mmMessageManager.GetAllMessages(Object languagePK) +617
OakLeaf.MM.Main.Globalization.mmMessageManager.GetMessageCache(Object LanguagePk, Boolean ForceReload) +337
OakLeaf.MM.Main.Globalization.mmMessageManager.GetMessageCache(Object LanguagePk) +56
OakLeaf.MM.Main.Globalization.mmMessageManager.GetMessage(String messageKey, Object languagePK, Boolean returnMessageKeyIfNotFound) +181
OakLeaf.MM.Main.Globalization.mmMessageManager.GetMessage(String messageKey, Object languagePK) +59
OakLeaf.MM.Main.Web.UI.WebControls.mmLabel.LocalizeText(Object languagePK) +163
OakLeaf.MM.Main.Web.UI.WebControls.mmLabel.LocalizeHandler(Object sender, mmLocalizeEventArgs e) +54
OakLeaf.MM.Main.Web.UI.mmLocalizeDelegate.Invoke(Object sender, mmLocalizeEventArgs e) +0
OakLeaf.MM.Main.Web.UI.mmBaseWebPage.OnLocalize(Object languagePK) +126
OakLeaf.MM.Main.Web.UI.mmBaseWebPage.OnLoad(EventArgs e) +165
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3036
Linda Harmes
HiBit Technologies, Inc.
Next
Reply
Map
View

Click here to load this message in the networking platform