Object SQLConnection is used object to arrange the [relation/link] with SQL Server
Member Objek SQLConnection :
- Properties
a. Connection String
b. Connection TimeOut
c. Database PacketSize
d. Server Version
e. State
f. WorkstationId
- Method
a. ChangeDatabase
b. Close
c. CreateCommand
d. Open
Way uses:
- Require library object from :
imports system.data.sqlclient
- Syntax declaration :
Dim con ace new sqlconnection
- Inisialisasi value :
Con.Connectionstring == “ user id = user_SQLServer;password = password_user;data source = nama_server;initial catalog = Nama_Database;Connect timeout = nilai_timeout”
- Connect to Database
con.open()
- Connection Close
con.close()
Example [of] :
Imports System.Data.sqlclient
Module Module1
Sub
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:
Post a Comment