Skip to main content

Koneksi Database sqlserver 2005 ke vb.net 2008

Imports System.Data.SqlClient
----------------------------------------------------------------------------------------------------------
Module modulkoneksi
    Public mycn As New SqlConnection
----------------------------------------------------------------------------------------------------------
    Sub bukaconn()
        mycn.ConnectionString = "data source=.\sqlexpress;initial catalog=dbpejualan; integrated security=SSPI"

        If mycn.State = ConnectionState.Closed Then
            Try
                mycn.Open()
            Catch ex As Exception
                MsgBox(ex.Message)
                Application.Exit()

            End Try
        End If
    End Sub
End Module
---------------------------------------------------------------------------------------------------------


semoga bermanfaat ....

Comments

Popular posts from this blog

Urutan Kabel LAN ( straight & cross)

Urutan dan cara membuat kabel lan  1. Straight      kabel lan dan susunan seperti ini biasanya digunakan untuk menghungkan device yang berbeda.     ada 2 ujung kabel - ujung pertama dengan urutan warna : Putih Orenge , Orange, Putih Hijau , Hijau , Putih Biru ,Biru , Putih coklat, coklat. - ujung satunya dengan urutan yang sama. 2.Cross     Kabel dengan susunan seperti ini biasanya digunakan untuk menghubungkan device yang sama. contoh : komputer dengan komputer.      ada 2 ujung kabel  - ujung pertama dengan urutan warna : Putih Orenge , Orange, Putih Hijau , Hijau , Putih Biru ,Biru , Putih coklat, coklat.    - ujung kedua : Putih Hijau , Hijau , Putih Orange , Orange , Putih Biru , Biru , Putih Coklat , Coklat. Semoga bermanfaat.

Koneksi VB .Net Menggunakan Menggunakan ODBC

Imports System.Data.ODbC Module Module_koneksi Dim connection As New OdbcConnection( "DSN= NAMADSN ;" ) Private Sub connection_open() Try If connection.State <> ConnectionState.Closed Then connection.Close() connection.Open() Catch ex As Exception End Try End Sub Private Sub connection_close() Try If connection.State <> ConnectionState.Open Then connection.Open() connection.Close() Catch ex As Exception End Try End Sub End Module

cara membuat hapus data di vb.net 2008

public function hapus data () as integer '--------------------------------------------- 'class untuk menghapus data '--------------------------------------------- dim sql as string dim xcmd as sqlcomand dim x sql ="delete from siswa where nis=@nis" xcmd = new sqlcommand (sql ,con) xcmd.paramater.addwithvalue("nis", Fnis) x = xcmd.executenonquery xcmd.dispose () return x end function