How to validate/save date in Asp.Net using VB.NET? -


this question has answer here:

this code meant save date

if(not string.isnullorempty(datetxt.text)) sqlcmd.parameters.add("@dte",sqldbtype.date)=datetxt.text.trim() end if 

what must add code validation too?

check answer here,

dim datevalue date if string.isnullorwhitespace(dobtxt.text)     sqlcmd.parameters.add("@dob", sqldbtype.date).value = dbnull.value elseif date.tryparse(dobtxt.text.trim(), datevalue)     sqlcmd.parameters.add("@dob", sqldbtype.date).value = datevalue else     ' alert user there invalid input end if 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -