Group: Forum Members
Posts: 235,
Visits: 309
|
I have built a bo library that corresponds to 3 tables in my database. The one I am working with is a table of users. It is my intention to test the new serialize to stream function.
There are 3 issues here
The table schema looks like this:
new DataColumn("ID", typeof(System.String)),
new DataColumn("LAST_NAME", typeof(System.String)),
new DataColumn("FIRST_NAME", typeof(System.String)),
new DataColumn("MI", typeof(System.String)),
new DataColumn("TITLE", typeof(System.String)),
new DataColumn("LIC_NO", typeof(System.String)),
new DataColumn("DEA", typeof(System.String)),
new DataColumn("EMP_NO", typeof(System.String)),
new DataColumn("INSVC_DATE", typeof(System.DateTime)),
new DataColumn("OSVC_DATE", typeof(System.DateTime))
etc...
I created a Strataframe windows app and added boAllUsers1 instance to the form and added a button with the follwoing handler:
private void button1_Click(object sender, EventArgs e)
{
Stream myStream;
boAllUsers1.NewRow();
boAllUsers1.ID = "FRED";
boAllUsers1.SerializeToStream(myStream);
BOLibrary.boAllUsers allUsers = (BOLibrary.boAllUsers)BusinessLayer.DeserializeBusinessObject(myStream);
MessageBox.Show(allUsers.ID);
}
1)---------------------------------------------------------------
The first error I get is in the attached jpeg and I don't understand it.
2)---------------------------------------------------------------
The second error is when I try to execute:
boAllUsers1.ID = "FRED";
The error is:
{"Input string was not in a correct format.Couldn't store in ID Column. Expected type is Int32."}
Since this is a string field in the DB and the BO was built knowing that it is a string field, why is it complaining that I cannot put a string in an integer field?
3)---------------------------------------------------------------
Since .NET does not provide a constructor that will create a new empty stream, perhaps it would be better if SerializeToStream returned a Stream and SerializeToByteArray returned a ByteArray rather than taking them as input parameters?
Thank you
|