SQL INSERT

Afternoon All

Outline
Im reading a mailbox then iterating through each mail and performing a set of actions
One of those actions as taking details from the said e-mail and loading the to an SQL db

This is what I am using
“INSERT INTO EmailLog (Sender) VALUES (’” +item.Sender.Address.ToString + “’);”

but I get

Execute Non Query: String or binary data would be truncated.
The statement has been terminated.

1 Like

What is the field length within the datatable?
It could be the string is too long for the field.

1 Like

Thanks

it was set at 10 doh

1 Like

@Jersey_Practical_Sho Check variable length if it’s 10 than below 10 character only u can insert the value so now item.Sender.Address.ToString is having more than 10 characters so you are getting error increase length and check

1 Like

No problem, sometimes is the smallest things J

1 Like