-1

please can some one help me on how to connect different vb applications to a database server.like accessing data from one database by different applications...

3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by Netcode
-1

Here is a good resource:
http://dev.mysql.com/tech-resources/articles/dotnet/

And here is some sample code for connecting to a MySql database.

Imports MySql.Data.MySqlClient

Module Module1

   Sub Main()
      Dim csb As New MySqlConnectionStringBuilder
      csb.UserID = "user"
      csb.Password = "pswd"
      csb.Server = "10.xx.xx.xx"
      csb.Database = "DB_NAME"

      Dim strSQL As String = "select COMMENTS from audit where ELEMENT='ZZZ630'"

      Dim conn As New MySqlConnection(csb.ToString())
      conn.Open()

      Dim cmd As New MySqlCommand(strSQL, conn)
      Dim rdr As MySqlDataReader = cmd.ExecuteReader()

      While rdr.Read()
         Console.WriteLine(rdr("COMMENTS").ToString().Trim())
      End While

      rdr.Close()
      conn.Close()
   End Sub

End Module
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.