Quantcast
Channel: Silk Test - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 625

How do I connect to a MySQL database from within my silktest workbench scritpts

$
0
0

I am trying to retrieve the data from a MySQL database using vb.net scripts within the silktest workbench. code like followings

 

 

Imports MySql.Data.MySqlClient

PublicModule Main

PublicSub DBconnect(secCUSIP AsString)

 

' 1350Z7SS4

Dim Connection As MySqlConnection

Dim command As MySqlCommand

 

Connection = New MySqlConnection

Connection.ConnectionString = "Server=cd-p-qa-db1;port=3306;userid=admin_security;password=admin_security;database=security"

Dim reader As MySqlDataReader

 

Try

Connection.Open()

Dim query AsString

query= "Select * from security.security where ReferenceID='"& secCUSIP & "'"

Command = New MySqlCommand(query, Connection)

reader = Command.ExecuteReader

While reader.Read

Dim Des AsString

Des = reader.GetString("Description")

Console.WriteLine(Des)

' textbox1.Items.Add(sname)

EndWhile

Connection.Close()

Catch e MySqlException

MsgBox (ex.Message)

Finally

Connection.Dispose

EndTry

EndSub

EndModule

 

After running I got "Namespace or type specified in the Imports 'MySql.Data.MySqlClient' 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."

 

I tried to imports"System.Data.MySQLClient". still got same error. I am wondering what is the name space I should import?

 

 


Viewing all articles
Browse latest Browse all 625

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>