Imports System
Imports System.Data
Imports System.Data.SqlClient
Module ModSys
Public Declare Auto Function GetSystemMenu Lib "user32" (ByVal hwnd As IntPtr, ByVal bRevert As Int32) As IntPtr
Public Declare Auto Function RemoveMenu Lib "user32" (ByVal hMenu As IntPtr, ByVal nPosition As Int32, ByVal wFlags As Int32) As Int32
Public Const MF_REMOVE As Int32 = &H1000&
Public Const MF_BYPOSITION As Int32 = &H400&
Public gConn As New SqlConnection
Public gStrcn As String
Public sServName, sUser, sPass As String
Public Const sLabel = "Mobile City Co.,Ltd."
Public sqlNumIm As String
Public sqlNumSA As String
Public tmpProID, tmpProN As String
Public tmpProIDOr, tmpProNOr As String
Public tmpSale, tmpCost, tmpSaleS, ctmpSale As Long
Public tmpPINShop, tmpPINOr, ctmpINShop As Integer
Public tmpSuppID, tmpSuppN As String
Public tmpUserName As String
Public bhIDor, bhIDSa, bhIDSaCre As String
Public tmpCustID, tmpCustN, tmpSex, tmpIDCard, tmpAddr, tmpTel As String
Public tmpProIDSa, tmpProNSa As String
Public ctmpProID, ctmpProN As String
Public strPath As String
Public tOrderID, tSaleID, tSaleCreID As String
Public Function DbConnect() As Boolean
On Error GoTo error_handle
Dim gConn As SqlConnection
'If gConn.State = ConnectionState.Closed Then
'gConn = New SqlConnection
'With gConn
'.ConnectionString = "Data Source=mint-nb;Catalog=account;User Id=sa;Password=123456"
'Integrated Security=True"
'.ConnectionString = "Data Source=orcl_ao.hcwml.com;User Id=sak;Password=tc123456"
'gConn.Open()
'MsgBox("Connection Complete", vbOKOnly + vbInformation, "CONNECTION")
'End With
'End If
'gConn = New System.Data .Sql .
gConn = New SqlConnection
gConn.ConnectionString = "Data Source=ACER-PC;Initial Catalog=account;User Id=sa;Password=p@ssw0rd"
DbConnect = True
Exit Function
error_handle:
MsgBox(Err.Description & Chr(10) & "Error: Can not connect to database" & _
"Please contact administrator", _
vbOKOnly, "ConnectDB Error")
DbConnect = False
End Function
End Module
คือผมจะต้องเปลี่ยนตรงจุดไหนบ้างเหรอครับ
Tag : .NET, Ms SQL Server 2008, VS 2008 (.NET 3.x)