1
我是新來的Visual Basic,但我需要遍歷數據表中的行,並在測試腳本中使用的值,該腳本如下 -循環通過行動
Public Function TestMain(ByVal args() As Object) As Object
StartApp(URL)
' HTML Browser '
Browser_HtmlBrowser(Document_HomePage(),DEFAULT_FLAGS).Maximize()
Button_AddNewProfilesubmit().Click()
'here is where the rows would be read and the loop would start'
Text_Ctl00MainContentProfileNa().Click(AtPoint(6, 13))
Browser_HtmlBrowser(Document_Http1921685526UserCon(), DEFAULT_FLAGS).InputChars("dataBase_Row_Value")
Table_HtmlTable_1().Click(AtCell(_
AtRow(AtIndex(0)), _
AtColumn(AtIndex(1))))
'here is where the loop would end after all rows had been read'
Return Nothing
End Function
我有一個想法來實現這一點,首先做一個數據庫連接,然後創建循環 -
Dim pName As String
Dim datas As DataSet
Dim datar As DataRow
Dim oledat As SqlDataAdapter
oledat = New SqlDataAdapter("SELECT COLUMN FROM DATABASE",ConnectionString)
oledat.Fill(datas)
For Each datar In datas.Tables(0).Rows
pName = datar.Item("PROFILENAME")
Text_Ctl00MainContentProfileNa().Click(AtPoint(6, 13))
Browser_HtmlBrowser(Document_Http1921685526UserCon(), DEFAULT_FLAGS).InputChars(pName)
Table_HtmlTable_1().Click(AtCell(_
AtRow(AtIndex(0)), _
AtColumn(AtIndex(1))))
Next
然而,這是打破,即使有在Visual Studio中沒有錯誤,也僅僅是datas
之前使用的警告它被分配價值。我哪裏錯了?
當你說這是打破你的意思。運行時會出錯嗎?如果是的話,錯誤是什麼。 – 2013-03-07 11:13:07
當調試它不運行時,它只是說有構建錯誤,我用C#編程,如果有錯誤,它會這樣說。我正在使用IBM的理性測試軟件來生成腳本。 – Ebikeneser 2013-03-07 11:14:33
那麼,構建錯誤是什麼?你說你剛剛有一個警告 - 這不會阻止它編譯 – 2013-03-07 11:15:41