Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27517

Connect VB Net to Xampp SQL server

$
0
0
So I've had no problems programming with vb net and connecting to Access databases. But now I've installed the Xampp package with Apache and the works. I have a host name connected to my ip using noip.com. The address is mtsonline.no-ip-org So of course if I enter that into any browser right now on any computer it connects to my apache webserver. Now what I want to do is using vb net to access the mysql database I've created located under xampp\mysql\data\mtsonline where mtsonline is the database folder I created.

Basically I just need to get the connection going.. Once I get that, the rest will be fine for me to accomplish. So here's what I have:

Imports System.Data.Sql
Imports System.Data.SqlClient


Public Class SQLControl
Public SQLCon As New SqlConnection With {.ConnectionString = "Server=mtsonline.no-ip.org;Database=mtsonline;User ID=admin;password=admin;"}

Public SqlCmd As SqlCommand

Public Function HasConnection() As Boolean
Try
SQLCon.Open()

SQLCon.Close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
Return False
End Try
End Function
End Class[/CODE][/CODE]

Then just on my form Load event:

If SQL.HasConnection = True Then
MsgBox("Successfully connected")
End If

Of course at this point it returns an error saying it could not establish a connection. Any help would be greatly appreciated.

Viewing all articles
Browse latest Browse all 27517

Latest Images

Trending Articles



Latest Images

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