c# - Is it Possible to ignore expected parameter -


.net     if (ssn.contains("x))     {     cmd.parameters.addwithvalue(nothing ignore);     } 

-

stored procedure select case when ssn null '' else case when ssn = '' '' else 'xxxxx' + right(rtrim(ssn),4) 

-

stored procedure update @currentuser varchar(30), @ssn varchar(11) = null  set [ssn] = [@ssn] [currentuser] = [@currentuser] 

when read value want xxx-xx-1234 value exist in textbox , dont want user click update , save xxx-xx-1234 database. best way handle that?

if declare stored procedure default value, in case:

@ssn varchar(11) = null 

you don't have pass if don't need to. don't do

cmd.parameters.addwithvalue 

for it, in fact simple skip when adding parameters stored procedure , parameter not "expected", value of null assigned default.

but if simple don't want update - don't. check textbox specific value , if incorrect - skip call db update.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -