The preferred route would be to create a stored procedure that takes your parameters and does all of the decisions on update or insert within the procedure.
However, either way, you need to use Parameterized Queries. First of all it helps to protect against SQL Injection attacks, but there are three other important advantages
1. You don't have to worry about surround character or date values with single quotes
2. You (usually) don't have to worry about formatting dates or converting values ToString().
3. You only have to supply a parameter value once instead of having to concatenate the same value 2 or 3 times.
Something like this should work in your case - but note I have not been able to test this so there may be minor errors, possibly with the date formats.
Dim sb As StringBuilder = New StringBuilder("")
sb.Append("IF EXISTS(Select tsalesregdump_name From vsolv_trn_tsalesregdump Where tsalesregdump_name = ")
sb.Append("@Name AND tsalesregdump_vch_no=@VchNo AND tsalesregdump_date=@Date) BEGIN")
sb.Append(" Update vsolv_trn_tsalesregdump ")
sb.Append(" Set tsalesregdump_date = @Date ")
sb.Append(" ,tsalesregdump_executive = @Exec")
sb.Append(" ,tsalesregdump_vch_no = @VchNo")
sb.Append(" ,tsalesregdump_debit = @Debit")
sb.Append(" ,tsalesregdump_credit = @Credit")
sb.Append(" ,tsalesregdump_importby = 'SIVA' ")
sb.Append(" Where tsalesregdump_name = @Name")
sb.Append("END ELSE BEGIN ")
sb.Append(" Insert into vsolv_trn_tsalesregdump(tsalesregdump_date,tsalesregdump_name,tsalesregdump_executive,tsalesregdump_vch_no ")
sb.Append(" ,tsalesregdump_debit,tsalesregdump_credit,tsalesregdump_importby) ")
sb.Append(" Values (@Date,@Name,@Exec,@VchNo,@Debit,@Credit,'SIVA') ")
sb.Append("END ")
sqlCommand.CommandText = sb.ToString()
sqlCommand.Parameters.AddWithValue("@Name", dtDumpBooking.Rows(0).Item("tsalesdump_name"))
sqlCommand.Parameters.AddWithValue("@Date", dtDumpBooking.Rows(0).Item("tsalesdump_date"))
sqlCommand.Parameters.AddWithValue("@Exec", dtDumpBooking.Rows(0).Item("executivename_executive"))
sqlCommand.Parameters.AddWithValue("@VchNo", dtDumpBooking.Rows(0).Item("tsalesdump_vch_no"))
sqlCommand.Parameters.AddWithValue("@Debit", dtDumpBooking.Rows(0).Item("tsalesdump_debit"))
sqlCommand.Parameters.AddWithValue("@Credit", dtDumpBooking.Rows(0).Item("tsalesdump_credit"))
[EDIT] - sorry I forgot to answer your actual question!
To include other columns in your check just use an
AND
clause. I've highlighted the relevant bit in bold above.