N
nashak
What is a preferred method to handle form input from textboxes that can
be empty or null (in C#). If I pass these values as parameters to a
method, then they fail when there is no data in the field.
I can check the value and if empty set it to System.DB.Null and then
create a sqlparameter[] and pass this to my method? In the method, I
can create my command, connection objects and use the SqlParameter[] to
add them to command.paramters.add.
VB Code:
Dim SQLParam() As SqlClient.SqlParameter
SQLParam = New SqlParameter() {New SqlParameter("@SubjectID",
SubjectID), New SqlParameter("@StudyID", StudyIID)}
What will the equivalent code be in C#?
Thanks
be empty or null (in C#). If I pass these values as parameters to a
method, then they fail when there is no data in the field.
I can check the value and if empty set it to System.DB.Null and then
create a sqlparameter[] and pass this to my method? In the method, I
can create my command, connection objects and use the SqlParameter[] to
add them to command.paramters.add.
VB Code:
Dim SQLParam() As SqlClient.SqlParameter
SQLParam = New SqlParameter() {New SqlParameter("@SubjectID",
SubjectID), New SqlParameter("@StudyID", StudyIID)}
What will the equivalent code be in C#?
Thanks