• 1 reply
  • Latest Post - ‏2012-11-21T15:40:22Z by SystemAdmin
16727 Posts

Pinned topic RFT Using VB.Net To Connect To MS Access DB

‏2012-11-20T21:30:09Z |
Hi Everyone,

I am a brand new user to RFT. I just walked through the example of how to connect to an access DB in the book "Software Test Engineering with IBM Rational Functional Tester". I am getting an error when I try to run the script stating the following;

1 - Namespace or type specified in the Imports 'System.Data.OleDb' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.
2 - Type 'OleDbConnection' is not defined.

I assume this is regarding my imports statement at the top of the script (Imports System.Data.OleDb). When I don't use this import and give the full name of the connection (System.Data.OleDb.OleDbConnection) I still get an error. My code is below and it is straight out of the book. Any and all help is greatly appreciated. Thanks so much. Talk to you soon.

Public Function TestMain(ByVal args() As Object) As Object
' Connection String to MS Access DB
Dim connectStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Users\DMalerman\keyword.accdb;" & _
"Persist Security Info=True"
' Create connection to the db
Using connection As New System.Data.OleDb.OleDbConnection(connectStr)
' Create the SQL Query
Dim readQuery As String = "Select KeywordDriver.ScriptName from KeywordDriver " & _
"where KeywordDriver.Keyword = test"
Dim queryCommand As New OleDbCommand(readQuery, connection)

'Open the Connection

' Query the Database
Dim dbReader As OleDbDataReader = queryCommand.ExecuteReader()

' Loop until there is nothing left to read
While dbReader.Read()
Dim sKeyword As String = ""
sKeyword = dbReader.GetString(0)
End While
' Close the Reader

End Using

Return Nothing
End Function
Updated on 2012-11-21T15:40:22Z at 2012-11-21T15:40:22Z by SystemAdmin
  • SystemAdmin
    16727 Posts

    Re: RFT Using VB.Net To Connect To MS Access DB

    Could it be a .net framework thing? What version should I be using? Just a thought. Once again, thanks for any and all help. I really do appreciate it.