📄 客户信息查询.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form 客户信息查询
BorderStyle = 1 'Fixed Single
Caption = "客户信息查询"
ClientHeight = 7605
ClientLeft = 45
ClientTop = 435
ClientWidth = 8280
LinkTopic = "Form4"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 7605
ScaleMode = 0 'User
ScaleWidth = 82800
Begin VB.CommandButton Command3
Caption = "清空"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 5400
TabIndex = 10
Top = 1440
Width = 1455
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "客户信息查询.frx":0000
Height = 3015
Left = 600
TabIndex = 8
Top = 1920
Width = 6975
_ExtentX = 12303
_ExtentY = 5318
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.CommandButton Command2
Caption = " 退出 "
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4920
TabIndex = 5
Top = 6840
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "确定"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1680
TabIndex = 4
Top = 6840
Width = 1455
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 975
Left = 600
TabIndex = 3
Top = 5640
Width = 6975
_ExtentX = 12303
_ExtentY = 1720
_Version = 393216
Cols = 7
FixedCols = 0
End
Begin VB.Frame Frame1
Caption = "客户查询"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1095
Left = 600
TabIndex = 0
Top = 240
Width = 6975
Begin VB.TextBox Text2
Height = 375
Left = 4800
TabIndex = 7
Top = 480
Width = 1695
End
Begin VB.TextBox Text1
Height = 375
Left = 1200
TabIndex = 6
Top = 480
Width = 1695
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "客户名称"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 180
Left = 3840
TabIndex = 2
Top = 600
Width = 780
End
Begin VB.Label Label1
Caption = "客户编号"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 1
Top = 600
Width = 975
End
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 6360
Top = 6840
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=TDM;Data Source=2NBPC049"
OLEDBString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=TDM;Data Source=2NBPC049"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "kehu"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "查询结果"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 180
Left = 600
TabIndex = 9
Top = 5280
Width = 780
End
End
Attribute VB_Name = "客户信息查询"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If (Text1.Text = "" And Text2.Text = "") Then
MsgBox "客户编号和客户名称不能同时为空!", 48, "提示!"
Exit Sub
End If
Dim strSQL As String
If Text1.Text = "" Then
'strSQL = "sp_getkehu2('" + Trim(Text2.Text) + "')"
strSQL = "select * from kehu where customername='" + Text2.Text + "'"
ElseIf Text2.Text = "" Then
'strSQL = "sp_getkehu1('" + Text1.Text + "')"
strSQL = "select * from kehu where customercode='" + Text1.Text + "'"
Else
'strSQL = "sp_getkehu3('" + Trim(Text1.Text) + "','" + Trim(Text2.Text) + "')"
strSQL = "select * from kehu where customercode='" + Text1.Text + "' and customername='" + Text2.Text + "'"
End If '应注意上面的书写格式!!!
'strSQL = "sp_getkehu('" + Text1.Text + "','" + Text2.Text + "')"
Dim rs As New ADODB.Recordset
Dim cmd As New ADODB.command
cn.CursorLocation = adUseClient
cmd.ActiveConnection = cn
cmd.CommandType = adCmdText
cmd.CommandText = strSQL
Set rs = cmd.Execute '得到纪录集!!!
Do While Not rs.EOF
MSFlexGrid rs, MSFlexGrid1
rs.MoveNext
Loop
End Sub
Private Sub Command2_Click()
Unload 客户信息查询
End Sub
Private Sub MSFlexGrid(objrs As ADODB.Recordset, objgrid As MSFlexGrid)
'Dim a$, b$, c$, d$, e$, f$, g$, h$
Dim fcount As Integer, rcount As Integer
objgrid.Clear '清除原有数据
If objrs.EOF And objrs.BOF Then
End If
fcount = objrs.Fields.Count '得到Rs数据集字段的个数
'fcount = 7
rcount = objrs.RecordCount '得到Rs数据集的记录的个数
For i = 0 To fcount - 1
objgrid.ColWidth(i) = objrs.Fields(i).DefinedSize * 120
Next
objrs.MoveFirst
Do While Not objrs.EOF
For i = 0 To fcount - 1
objgrid.TextMatrix(objrs.AbsolutePosition, i) = objrs.Fields(i).Value '无效使用NULL????
Next
objrs.MoveNext
Loop
MSFlexGrid1.TextMatrix(0, 0) = "供应商号"
MSFlexGrid1.TextMatrix(0, 1) = "供应商名"
MSFlexGrid1.TextMatrix(0, 2) = "地址"
MSFlexGrid1.TextMatrix(0, 3) = "邮编"
MSFlexGrid1.TextMatrix(0, 4) = "联系电话 "
MSFlexGrid1.TextMatrix(0, 5) = "电子信箱"
MSFlexGrid1.TextMatrix(0, 6) = "备注"
objrs.MoveFirst '恢复游标到起始位置!!!
End Sub
Private Sub Command3_Click()
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub Form_Load()
MSFlexGrid1.TextMatrix(0, 0) = "供应商号"
MSFlexGrid1.TextMatrix(0, 1) = "供应商名"
MSFlexGrid1.TextMatrix(0, 2) = "地址"
MSFlexGrid1.TextMatrix(0, 3) = "邮编"
MSFlexGrid1.TextMatrix(0, 4) = "联系电话 "
MSFlexGrid1.TextMatrix(0, 5) = "电子信箱"
MSFlexGrid1.TextMatrix(0, 6) = "备注"
'cn.Close
'cn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=TDM;Data Source=2NBPC049"
'cn.Open '无此句不行!!
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -