Aim: I want to check if the value is Null
and it is then add blank otherwise add data
Issue: I am unsure on what I need to put after the first comma to change the Null
to ""
and also then if it actually has data to import that instead
With commandSQL
.Connection = connection
.CommandText = "spAddCSVDataLine" 'Stored procedure here
.CommandType = CommandType.StoredProcedure
.Parameters.AddWithValue("Name", (IsDBNull(ds.Tables("dataExcel").Rows(j)("Name"))),"",Trim(ds.Tables("dataExcel").Rows(j)("Name"))))
I can do the following but I would like to tighten the code up onto one line if possible:
If IsDBNull(ds.Tables("dataExcel").Rows(j)("Name")) Then
.Parameters.AddWithValue("Name", "")
Else
.Parameters.AddWithValue("Name", Trim(ds.Tables("dataExcel").Rows(j)("Name")))
End If