What i am having trouble doing is set the current parameter to the current row at a specific column like e.row[column index]
For Each trow As TableRow In table.Rows
cmd1.CommandText = "dbo.directway"
cmd1.CommandType = CommandType.StoredProcedure
cmd1.Connection = conn
cmd1.Parameters.AddWithValue("@tour", trow(0))
cmd1.Parameters.AddWithValue("@tourname", trow(1))
cmd1.Parameters.AddWithValue("@taskname", trow(2))
cmd1.Parameters.AddWithValue("@deptdate", trow(3))
cmd1.Parameters.AddWithValue("@duedate", trow(4))
cmd1.Parameters.AddWithValue("@tasktype", trow(5))
cmd1.Parameters.AddWithValue("@desc", trow(8))
cmd1.Parameters.AddWithValue("@agent", trow(6))
cmd1.Parameters.AddWithValue("@completed", trow(7))
conn.Open()
cmd1.BeginExecuteNonQuery()
conn.Close()
Next
Class ‘System.Web.UI.WebControls.TableRow’ cannot be indexed because it has no default property.
There are so many things wrong here …
First, you have a Command object named
cmd1, but you are adding parameters to an object namedcmd. Turn on Option Explicit. Second, VB.NET uses parenthesis around indexes, not square brackets. Third, you are calling variableeinstead oftrow, and you should be referencing trow(0), trow(1), etc. Fix these things up and then post an update.