Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Sql connection

$
0
0
I have a problem with checking if my database is connected to my project in vb.net, could someone help me? here is my codes, I would appreciate your help, this program that I'm currently working on is for my thesis BTW.

Imports System.Data.SqlClient
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim sqlconn As New SqlConnection
        sqlconn.ConnectionString = "server = (local);Database=OJT;integrated security=true"
        Try
            sqlconn.Open()
        Catch ex As Exception
            MessageBox.Show(ex.Message, "Connection to Sql Server Failed!", MessageBoxButtons.OK)
        End Try
        Me.Text = "You are successfully connected to Sql Server"
    End Sub
End Class


Viewing all articles
Browse latest Browse all 51036

Trending Articles



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