DannyC wrote:I have the plugin successfully writing a record to the GL_Segments table but as soon as I save, I get this error.
Check your collection Read() function. I suspect there is a reference to “RecID” when it should be “GLSegmentID”.
DannyC wrote:I have the plugin successfully writing a record to the GL_Segments table but as soon as I save, I get this error.
public override void Read()
{
string Sql = null;
SqlDataReader SQLReader = null;
bool oldReading = Reading;
try {
Reading = true;
Clear();
var db = Manager.Database;
Sql = @"SELECT GLSegmentID, SegContents, SegContentsDesc
FROM GL_Segments WHERE SegmentNo = 1
ORDER BY SegContents ";
using (SqlCommand SQLCmd = new SqlCommand(Sql, db.SQLConnection, db.SQLTransaction)) {
SQLCmd.CommandTimeout = Manager.Database.DefaultCommandTimeout;
SQLReader = SQLCmd.ExecuteReader();
while (SQLReader.Read() == true) {
//GLSegment GLSegment = new GLSegment();
GLSegment GLSegment = Manager.CollectionItemFactory.CreateCollectionItem<GLSegment>();
GLSegment.RecID = db.Sanitise(SQLReader, "GLSegmentID").ToString();
GLSegment.SegContents = db.Sanitise(SQLReader, "SegContents").ToString();
GLSegment.SegContentsDesc = db.Sanitise(SQLReader, "SegContentsDesc").ToString();
Add(GLSegment);
}
SQLReader.Close();
}
base.OnRead();
} finally {
Reading = oldReading;
if ((SQLReader != null)) {
SQLReader.Close();
}
}
}
GLSegment GLSegment = new GLSegment();
Return to Technical and or Programming
Users browsing this forum: No registered users and 7 guests