user1418723
user1418723

Reputation: 53

C# Multi line text box error

i have created an application, there i have try to save the data from multiline text box to data base. But it will shown a error like "String or binary data would be truncated.The statement has been terminated." why it will come, what should i do for store data from multiline textbox.

this is the code i have given for store the data for multiline textbox.

 cmd.Parameters.AddWithValue("@spec", TextBox3.Text);

Upvotes: 1

Views: 483

Answers (2)

Dan F
Dan F

Reputation: 12051

The error is telling you the value in the textbox is too big for the field/parameter

Check the definition of the parameter in the stored procedure, and the size of the field it is writing to.

Upvotes: 2

Gonzalo.-
Gonzalo.-

Reputation: 12682

That would happen because the Varchar lenght is less than the size of TextBox3.Text

Which is the lenght of the field ? For example, if is Varchar(5) and TextBox3.Text is "abcdef" you can't insert the text because it will be truncated

Upvotes: 2

Related Questions