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:
public class MessageManager : mmMessageManager
{
public MessageManager()
{
this.TableName = "Message";
this.PrimaryKey = "MessagePK";
this.DescriptionField = "MessageTxt";
this.MessageKeyField = "MessagePK";
this.MessageTextField = "MessageTxt";
}
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.