SQLCONNECTION

SQLCONNECTION

Object SQLConnection is used object to arrange the [relation/link] with SQL Server


Member Objek SQLConnection :

  1. Properties

a. Connection String

b. Connection TimeOut

c. Database PacketSize

d. Server Version

e. State

f. WorkstationId

  1. Method

a. ChangeDatabase

b. Close

c. CreateCommand

d. Open

Way uses:

  1. Require library object from :

imports system.data.sqlclient

  1. Syntax declaration :

Dim con ace new sqlconnection

  1. Inisialisasi value :

Con.Connectionstring == “ user id = user_SQLServer;password = password_user;data source = nama_server;initial catalog = Nama_Database;Connect timeout = nilai_timeout”

  1. Connect to Database

con.open()

  1. Connection Close

con.close()

Example [of] :

Imports System.Data.sqlclient

Module Module1

Sub Main()

Dim strcon Ace String

Dim con Ace New SqlConnection

strcon = " user id = sa; data source = bc-d04; initial catalog = Northwind; connect timeout = 30;“

con.ConnectionString = strcon con.Open()

Console.Writeline("Seting Koneksi = {0}", con.ConnectionString)

Console.Readline()

con.Close()

End Sub

End Module


Download PDF File

No comments: