Personal Mind of ASEP

Sepercik Rasa yang Tercurah

MyOLEDB Koneksi di vb.Net

‘ Declattion
Imports System.Data.OleDb

‘code

Private Sub btnConnect_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnConnect.Click
Dim Conn As OleDbConnection
Dim connStr As String
connStr = String.Format(“Provider=MySqlProv;” & _
“Location={0};Data Source={1};” & _
“User={2}; Password={3}”, _
txtServer.Text, txtDatabase.Text, _
txtUser.Text, txtPassword.Text)
Try
Conn = New OleDbConnection(connStr)
Conn.Open()
MsgBox(“Connected with ” + Conn.DataSource & _
Chr(10) + “Provider ” + Conn.Provider, _
MsgBoxStyle.Information, “Connected”)
Me.Text = “Connected with ” + Conn.DataSource
Catch ex As Exception
MsgBox(“Error to connecting : ” + ex.Message)
Finally
Conn.Close()
Conn.Dispose()
End Try
End Sub

September 26, 2005 - Posted by | Uncategorized

No comments yet.

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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: