My code is:
For index = 0 To dupColIndx - 1
expression(index) = dgvINSRT.Rows.Item(i).Cells.Item(index).Value.ToString
Next
Dim strInsrt As String = "INSERT INTO " & _
dbTbl & _
colStr & _
Strings.Replace(expression(0), "'", "''", 1, -1, CompareMethod.Binary) & "','" & _
Strings.Replace(expression(1), "'", "''", 1, -1, CompareMethod.Binary) & "','" & _
Strings.Replace(expression(2), "'", "''", 1, -1, CompareMethod.Binary) & "')"
In the code above instead of entering manually expression(0), expression(1), etc. I want the string to be concatenated automatically once I enter the value of 'n' for expression(n).
Thanks.
SqlCommand,OracleCommand, etc) to avoid issue with SQL injection (or to catch bad data). Would be easy enough to loop through your array to add each item as a parameter to the command object to send to the database. Need to know what type of command object you are using if this is the case, to write an appropriate code sample.