?? store.cls
字號:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "store"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Private mstoreid As String
Private moperator As String
Private maddress As String
Property Get storeid() As String
storeid = mstoreid
End Property
Property Let storeid(ByVal storeid As String)
mstoreid = storeid
End Property
Property Get operator() As String
operator = moperator
End Property
Property Let operator(ByVal operator As String)
moperator = operator
End Property
Property Get address() As String
address = maddress
End Property
Property Let address(ByVal address As String)
maddress = address
End Property
Public Sub Insert()
Connect "w"
sqlstr = "select * from store where storeid='" & storeid & "'"
rs.Open sqlstr
If rs.EOF = False Then
rs.Fields("operator") = operator
rs.Fields("address") = address
' "已經有該倉庫的id,請選擇其他的"
'Disconnect
'Exit Sub
Else
rs.AddNew
rs.Fields("storeid") = storeid
rs.Fields("operator") = operator
rs.Fields("address") = address
End If
rs.Update
MsgBox "添加成功"
Disconnect
End Sub
'Public Function GetStoreids() As String()
' Dim storeids() As String
' ReDim Preserve storeids(1)
' storeids(0) = "**beginstoreids**"
' Connect "r"
' sqlstr = "select storeid from store"
' rs.Open sqlstr
' Do While Not rs.EOF
' ReDim Preserve storeids(UBound(storeids) + 1)
'storeids(UBound(storeids) - 1) = rs.Fields("storeid")
' rs.MoveNext
'Loop
'Disconnect
'GetStoreids = storeids
'End Function
Public Function GetStoreids() As String()
Dim GetStoreid As CPublic
Set GetStoreid = New CPublic
GetStoreids = GetStoreid.GetListIDs("Store", "storeid")
End Function
Public Sub Query()
Connect "r"
sqlstr = "select * from store where storeid='" & storeid & "'"
rs.Open sqlstr
If Not IsNull(rs.Fields("operator")) Then
operator = rs.Fields("operator")
Else
operator = ""
End If
If Not IsNull(rs.Fields("address")) Then
address = rs.Fields("address")
Else
address = ""
End If
Disconnect
End Sub
Public Sub modify()
Connect "w"
sqlstr = "select * from store where storeid='" & storeid & "'"
rs.Open sqlstr
If rs.EOF Then
MsgBox "倉庫名稱出錯,請確認倉庫名稱"
Disconnect
Exit Sub
End If
rs.Fields("operator") = operator
rs.Fields("address") = address
rs.Update
Disconnect
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -