Set ADOP = New ADODB.Recordset
Sql = "SELECT [per].[peid], [per].[xm], [per].[xb], [per].[mz], [bm].[mq], [per].[zwid], [per].[sfgh], [per].[dh], [per].[wfqd],[per].[zzsr], [per].[txdz], [per].[rzpm], [per].[rzrq], [per].[bz]" _
& "FROM bm INNER JOIN per ON [bm].[bmid]=[per].[bmid] where peid like '%" & TxtPh & "%'or xm like '%" & TxtPh & "%' order by peid "
ADOP.Open Sql, db, adOpenDynamic, adLockReadOnly, 1
Set DataGrid1.DataSource = ADOP
With DataGrid1
.Columns(0).Width = 555
.Columns(1).Width = 900
.Columns(2).Width = 540
.Columns(3).Width = 1695
.Columns(4).Width = 975
.Columns(5).Width = 1214
.Columns(6).Width = 2204
.Columns(7).Width = 1500
.Columns(8).Width = 1019
.Columns(9).Width = 989
.Columns(10).Width = 3945
.Columns(11).Width = 989
.Columns(12).Width = 1005
.Columns(13).Width = 4155
.Columns(0).Caption = "工号"
.Columns(1).Caption = " 姓 名"
.Columns(2).Caption = "性别"
.Columns(2).Alignment = dbgCenter
.Columns(3).Caption = "民族"
.Columns(4).Caption = "所属部门"
.Columns(5).Caption = " 职位"
.Columns(6).Caption = " 身份证号"
.Columns(7).Caption = " 联系电话"
.Columns(8).Caption = "文化程度"
.Columns(9).Caption = "正在使用"
.Columns(9).Alignment = dbgCenter
.Columns(10).Caption = " 通信地址"
.Columns(11).Caption = "邮政编码"
.Columns(12).Caption = "入职日期"
.Columns(13).Caption = " 备注"
private sub command1_click()
datagrid1.update
end sub