vb MSHFlexgrid使用 打印

来源:百度知道 编辑:UC知道 时间:2024/05/14 09:10:47
我用VB做的一个查寻,但是显示的结果老是查寻两次数据库的结果
========================================================
Private Sub BTfind_Click()
DataTxt.Text = Format(txtRudate, "yyyy-mm-dd")
Call OpenConn
sql = "select * from s_customer"
rs.Open sql, cn, , 1, 1
Set MSHFlexGrid1.DataSource = rs
' txtSQL = txtSQL & " order by student_ID "
'Set mrc = ExecuteSQL(txtSQL, MsgText)

With MSHFlexGrid1
' .Row = 2
.CellAlignment = 4
.TextMatrix(0, 1) = "客户编号"
.TextMatrix(0, 2) = "客户姓名"
.TextMatrix(0, 3) = "联系电话"
.TextMatrix(0, 4) = "联系地址"
.TextMatrix(0, 5) = "交款数额"
.TextMatrix(0, 6) = "旅行信息"
.TextMatrix(0, 7) = "交款时间"
.TextMatrix(0, 8) = "经办人"

Do While Not rs.EOF
.R

你已经将数据库与GRID控件绑定了,那就不必再用查询语句显示一遍了,绑定已经帮你做了一遍了.如果你要打印,请E-MAIL给我,我将发一个控件给你.我的E-MAIL:chenzg1122@163.com