I am trying to connect to a database but I have no clue how to do it or if it's even possible. The server address is: sql306.byethost5.com
How would I connect to this server if the username is usn and password is pwd?

Recommended Answers

All 2 Replies

Is it a MySQL database?
First you'd need to make sure your host allows connections from outside of their network (I mean this as in my friend's host SQL server only allows internal connections from his webspace or PHPMySQL Admin page - he can't use MySQL admin tools or anything on his PC)

You would need to check out http://www.connectionstrings.com when you know what SQL database system it is using (MSSQL, Oracle, MySQL etc)

It's a MySQL database. I'm not sure I'm using the right code.

Imports System.Data.SqlClient
  
      Public Class Form1
  
       
   
          Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        
          Dim sqlConn As New SqlConnection("server=serverAddress;uid=username;pwd=password;database=database;")

      sqlConn.Open()

     sqlConn.Close()
  End Sub

      End Class
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.