Database Connection Help

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Apr 2009
Posts: 2
Reputation: olabaz is an unknown quantity at this point 
Solved Threads: 0
olabaz olabaz is offline Offline
Newbie Poster

Database Connection Help

 
0
  #1
Apr 23rd, 2009
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?
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 141
Reputation: jonifen is an unknown quantity at this point 
Solved Threads: 15
jonifen jonifen is offline Offline
Junior Poster

Re: Database Connection Help

 
0
  #2
Apr 23rd, 2009
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)
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 2
Reputation: olabaz is an unknown quantity at this point 
Solved Threads: 0
olabaz olabaz is offline Offline
Newbie Poster

Re: Database Connection Help

 
0
  #3
Apr 24th, 2009
It's a MySQL database. I'm not sure I'm using the right code.

  1. Imports System.Data.SqlClient
  2.  
  3. Public Class Form1
  4.  
  5.  
  6.  
  7. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  8.  
  9. Dim sqlConn As New SqlConnection("server=serverAddress;uid=username;pwd=password;database=database;")
  10.  
  11. sqlConn.Open()
  12.  
  13. sqlConn.Close()
  14. End Sub
  15.  
  16. End Class
Last edited by olabaz; Apr 24th, 2009 at 5:07 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 417 | Replies: 2
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC