4
Answers

Hi this will be easy for you guys - Linq Insert - Please Help

Ask a question
 

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);

 


Answers (4)