Hi,
For one customercode e.g. 8900345 in a textbox it works fine but when trying to insert to more than one account entry on a multi line text box it says
"String or binary data would be truncated.
The statement has been terminated."
Do you know what i'm doing wrong?
Thanks
private void button10_Click(object sender, EventArgs e)
{
String[] lines = textBox58.Text.Split('\n');
foreach (String l in lines)
{
MessageBox.Show("Customer " + l);
EbillzDataContext InNotes = new EbillzDataContext();
Note Notes = new Note();
Notes.CustomerCode = l;
Notes.ActionUser = "VT2";
Notes.Complete = true;
Notes.Details = "CustomerCode: " + l + Environment.NewLine + "Awaiting ISP Details." + Environment.NewLine; // +
Notes.NoteDate = DateTime.Now;
Notes.Subject = "Router Info";
Notes.User = System.Environment.UserName; ;
Notes.NoteType = "Awaiting ISP";
Notes.PercentComplete = 100;
Notes.Deadline = DateTime.Now.AddDays(1);
InNotes.Notes.InsertOnSubmit(Notes);
InNotes.SubmitChanges();
MessageBox.Show("Note has been added for customer " + l);
VulpesPosted May 6, 2011, 10:18 AM
String[] lines = textBox58.Text.Split('\n');
to this:
String[] lines = textBox58.Lines;
and this line:
Notes.CustomerCode = l;
to this:
Notes.CustomerCode = l.Trim();
If it isn't any better, then can you pinpoint from the debugger on which line the problem occurs.
Anthony ClarkePosted May 10, 2011, 6:47 AM
Thanks again for your time :)
Regards
Anthony
Anthony ClarkePosted May 6, 2011, 10:04 AM
KF16037092
KF16037085
MS16037036
It works with one but not with more than one.
Thanks
Anthony
VulpesPosted May 6, 2011, 9:17 AM