G
Guest
Hi,
I am baffled as to why I can't seem to get this while statement to bail out
when it iterates to an empty row? Thanks.
While (Not IsNothing(objExcel.worksheets(h).cells(i, 1)))
Try
connection.Open()
Dim command As New SqlCommand("sp_insertClaId",
connection)
command.CommandType = CommandType.StoredProcedure
command.Parameters.Add("@iPubId", Int(TextBox1.Text))
command.Parameters.Add("@sCode",
objExcel.worksheets(h).cells(i, j).Value())
command.Parameters.Add("@sName",
objExcel.worksheets(h).cells(i, j + 1).Value())
command.Parameters.Add("@iCatIdOffset", h - 2)
command.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.Message.ToString())
Finally
connection.Close()
End Try
i = i + 1
k = k + 1
End While
I am baffled as to why I can't seem to get this while statement to bail out
when it iterates to an empty row? Thanks.
While (Not IsNothing(objExcel.worksheets(h).cells(i, 1)))
Try
connection.Open()
Dim command As New SqlCommand("sp_insertClaId",
connection)
command.CommandType = CommandType.StoredProcedure
command.Parameters.Add("@iPubId", Int(TextBox1.Text))
command.Parameters.Add("@sCode",
objExcel.worksheets(h).cells(i, j).Value())
command.Parameters.Add("@sName",
objExcel.worksheets(h).cells(i, j + 1).Value())
command.Parameters.Add("@iCatIdOffset", h - 2)
command.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.Message.ToString())
Finally
connection.Close()
End Try
i = i + 1
k = k + 1
End While