Live Chat Icon For mobile
Live Chat Icon

Why do I get the error message ‘Object must implement IConvertible’. How can I resolve it

Platform: ASP.NET| Category: Basic

The common cause for this error is specifying a control as a SqlParameter’s Value instead of the control’s text value.

For example, if you write code as below you’ll get the above error:


Dim nameParameter As SqlParameter = command.Parameters.Add('@name', SqlDbType.NVarChar, 50)
nameParameter.Value = txtName


SqlParameter nameParameter = command.Parameters.Add('@name', SqlDbType.NVarChar, 50);
nameParameter.Value = txtName ;

To resolve it, specify the control’s Text property instead of the control itself.


nameParameter.Value = txtName.Text


nameParameter.Value =txtName.Text;

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.