Header Ads

  • Breaking News

    Connect Windows ce6 sql server

    Imports System.Data
    Imports System.Data.Odbc
    Imports System.Data.OleDb
    Imports System.Data.SqlClient
    '########### FOR LOCAL AREA #########
    Public Class Form1
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'Dim connectionString As String = GetConnectionString()
            'Using connection As New SqlConnection()
            '    connection.ConnectionString = connectionString
            '    Try
            '        connection.Open()
            '        MessageBox.Show("Connect Complete")
            '    Catch ex As Exception
            '        MessageBox.Show(ex.Message.ToString)
            '    End Try
            '    Console.WriteLine("State: {0}", connection.State)
            '    Console.WriteLine("ConnectionString: {0}", _
            '    connection.ConnectionString)
            'End Using

            Dim sString As String = "dsn=SQLSERVER;uid=sa;pwd=sa;"
            Dim dbCon As New OdbcConnection(sString)
            Dim dbCmd As New OdbcCommand
            Try
                dbCon.Open()
                MessageBox.Show("Connect Complete")
            Catch ex As Exception
                MessageBox.Show(ex.Message.ToString)
            End Try
        End Sub

        Private Function GetConnectionString() As String
            Return "Data Source=192.168.101.3\SQLExpress;Initial Catalog=TEST;" _
                & "User ID=sa;" _
                & "Password=seiwa@1234;" _
                & "Persist Security Info=True;"
        End Function
    End Class

    1567662143654

    ไม่มีความคิดเห็น

    Post Top Ad

    ad728

    Post Bottom Ad

    ad728