Advertisement
binjeeclick

sql

Nov 25th, 2018
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.71 KB | None | 0 0
  1. Imports System.Data.Sql
  2. Imports System.Data.SqlClient
  3. Module Module1
  4.     Public koneksi As SqlConnection
  5.     Public data As DataSet
  6.     Public baca As SqlDataReader
  7.     Public adaptor As SqlDataAdapter
  8.     Public cmd As SqlCommand
  9.     Public ass As DataTable
  10.     Public sql As String
  11.  
  12.     Public Sub buka()
  13.      
  14.         sql = "Data Source=ADMIN-PC\SQLEXPRESS;Initial Catalog=dtoee;Persist Security Info=True;UID=sa;PWD=123456"
  15.         koneksi = New SqlConnection(sql)
  16.         Try
  17.             If koneksi.State = ConnectionState.Closed Then
  18.                 koneksi.Open()
  19.             End If
  20.         Catch ex As Exception
  21.             MsgBox(Err.Description, MsgBoxStyle.Critical, "Error")
  22.         End Try
  23.     End Sub
  24. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement