Connect to Datasource in VB.Net

Private Sub btnConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConnect.Click
Try
ConnectionString = “Data Source= ” + txtdatasource.Text + “;Initial Catalog=” + txtinitialcat.Text + “;Integrated Security=SSPI;User ID=sa;Password=test;Connection Timeout=60”
MessageBox.Show(ConnectionString)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s