Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a limit for the Parameters.AddWithValue?

Status
Not open for further replies.

LonnieJohnson

Programmer
Apr 16, 2001
2,628
US
I have an application that I am sending parameters to a stored procedure. I have a field that is a varchar(8000) in the table and a parameter in my sproc that is also varchar(8000).

However, when I send over 4000 characters via the Parameters.AddWithValue process it bombs with this message...

Implicit conversion from data type ntext to varchar is not allowed. Use the CONVERT function to run this query.

Any ideas?


ProDev, Builders of Affordable Software Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
The error says it all. You cannot implicitly convert ntext to varchar. You have to use the sql Convert() function. It may not work at all if you exceed 8000 chars.
 
My string is actually 7074 characters. This only happens if the text input into the front end asp.net form is over 4000 chars.

I changed my Parameters.AddWithValue to Parameters.Add and set the 8000 for this parm in the code. Then set the "Value" property of the parm equal to the text box.

This is working for me.

ProDev, Builders of Affordable Software Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top