c# - ADO.NET parameters from TextBox -


i'm trying call parameterized stored procedure sql server 2005 in c# winforms app. add parameters textboxeslike (there 88 of them):

cmd.parameters.add("@customername", sqldbtype.varchar, 100).value = customername.text; 

i following exception:

"system.invalidcastexception: failed convert parameter value  textbox string. ---> system.invalidcastexception:  object must implement iconvertible." 

the line throwing error when call query:

cmd.executenonquery(); 

i tried using .tostring() method on textboxes, seemed pointless anyway, , threw same error. passing parameters incorrectly?

it's probable forgot specify text property when assigning 1 of parameter values.

for example, instead of:

customername.text 

you may have done just:

customername 

this easy thing miss if there 88 of them.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -