⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modsql.bas

📁 VB 编写的"华成POS管理系统",代码全,没有进行测试,数据库全,有兴趣的朋友可以测试.
💻 BAS
字号:
Attribute VB_Name = "Modsql"
Public strposno As String 'pos编号
Public strposname As String '超市名称
Public strposadd As String '超市地址
Public strpostel As String '超市电话
Public strposdo As String '钱柜配置文件

Public strsy As String 'pos编号
Public strss As String '超市名称
Public strsz As String '超市地址
Public strsno As String '超市电话
 Public powbb As String


Public strSQLServer As String   'SQL服务器地址
Public strSQLUser As String 'SQL用户名
Public strSQLPW As String 'SQL密码
Public strSQLDB As String 'SQL数据库
Public cnMain As New ADODB.Connection   '主连接


'连接SQL服务器
Public Function sqlConnect(ByVal cnThis As ADODB.Connection, ByVal strServer As String, ByVal strUser As String, ByVal strPass As String, Optional ByVal strDataBase As String = "")
    Dim strsql As String
    '生成连接字符串
    strsql = "provider=sqloledb;server=" & strServer & ";user id=" & strUser & ";password=" & strPass
    If strDataBase <> "" Then strsql = strsql & ";database=" & strDataBase  '如果需要连接到数据库
    cnThis.Open strsql
End Function

'读取SQL服务器配置信息
Public Sub readServer()
On Error GoTo aaaa
    Dim strTmp As String, strT() As String
    Open GetApp & "Files\sql.inf" For Input As #1
        If EOF(1) = False Then Line Input #1, strTmp
    Close #1
    strTmp = Trim(strTmp)
    If strTmp <> "" Then
        strT = Split(strTmp, "||")
        For i = 0 To 3
            strT(i) = strT(i)
        Next
        strSQLServer = strT(0)
        strSQLUser = strT(1)
        strSQLPW = strT(2)
        strSQLDB = strT(3)
    End If
Exit Sub
aaaa:
    strSQLServer = ""
    strSQLUser = ""
    strSQLPW = ""
    strSQLDB = ""
End Sub

'保存SQL服务器配置信息
Public Sub SaveServer(ByVal strServer As String, ByVal strUser As String, ByVal strPass As String, ByVal strDataBase)
On Error GoTo aaaa
    Open GetApp & "Files\sql.inf" For Output As #1
        Print #1, strServer & "||" & strUser & "||" & strPass & "||" & strDataBase
    Close #1
Exit Sub
aaaa:
    MsgBox "保存 SQL 服务器信息失败!", vbCritical
End Sub
Public Sub readpos() '读pos配置信息
On Error GoTo aaaa
    Dim strTmp As String, strT() As String
    Open GetApp & "Files\pos.inf" For Input As #1
        If EOF(1) = False Then Line Input #1, strTmp
    Close #1
    strTmp = Trim(strTmp)
    If strTmp <> "" Then
        strT = Split(strTmp, "||")
        For i = 0 To 4
            strT(i) = strT(i)
        Next
        strposno = strT(0)
        strposname = strT(1)
        strposadd = strT(2)
        strpostel = strT(3)
        strposdo = strT(4)
    End If
Exit Sub
aaaa:
         strposno = ""
        strposname = ""
        strposadd = ""
        strpostel = ""
        strposdo = ""
End Sub

'保存pos配置信息
Public Sub SavePos(ByVal posno As String, ByVal posname As String, ByVal posadd As String, ByVal postel As String, ByVal posdo As String)
On Error GoTo aaaa
    Open GetApp & "Files\pos.inf" For Output As #1
        Print #1, posno & "||" & posname & "||" & posadd & "||" & postel & "||" & posdo
    Close #1
Exit Sub
aaaa:
    MsgBox "保存信息失败!", vbCritical
End Sub

Public Sub read() '读pos配置信息
On Error GoTo aaaa
    Dim strTmp As String, strT() As String
    Open GetApp & "Files\poss.inf" For Input As #1
        If EOF(1) = False Then Line Input #1, strTmp
    Close #1
    strTmp = Trim(strTmp)
    If strTmp <> "" Then
        strT = Split(strTmp, "||")
        For i = 0 To 3
            strT(i) = strT(i)
        Next
        strsy = strT(0)
        strss = strT(1)
        strsz = strT(2)
        strsno = strT(3)
        
    End If
Exit Sub
aaaa:
     strsy = ""
        strss = ""
        strsz = ""
        strsno = ""
End Sub

'保存pos配置信息
Public Sub Save(ByVal sy As String, ByVal ss As String, ByVal sz As String, ByVal sno As String)
On Error GoTo aaaa
    Open GetApp & "Files\poss.inf" For Output As #1
        Print #1, sy & "||" & ss & "||" & sz & "||" & sno
    Close #1
Exit Sub
aaaa:
    'MsgBox "保存信息失败!", vbCritical
End Sub

Public Sub Savezc(ByVal bb As String)
On Error GoTo aaaa
    Open GetApp & "Files\posy.inf" For Output As #1
        Print #1, bb
    Close #1
Exit Sub
aaaa:
    MsgBox "保存信息失败!", vbCritical
End Sub


Public Sub readbb() '读pos配置信息
On Error GoTo aaaa
    Dim strTmp As String, strT() As String
    Open GetApp & "Files\posy.inf" For Input As #1
        If EOF(1) = False Then Line Input #1, strTmp
    Close #1
    strTmp = Trim(strTmp)
    If strTmp <> "" Then
        strT = Split(strTmp, "||")
        For i = 0 To 1
            strT(i) = strT(i)
        Next
       powbb = strT(0)
        
        
    End If
Exit Sub
aaaa:
     powbb = ""
      
End Sub


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -