vb6.0+win2000+ado(求帮助)
问题1、如何把窗体form1中的dim sgm as string,sgm=text2.text的内容赋给DataReport中的LABEL1.caption(或text2.text),以便打印出来。
问题2、把窗体form1中的变量 dim sq as string ,sq=text1.text,如何在dataenvironment1中的 sql=select * from dj,de where dj.wjdm=de.wjdm and wjdm="'+sq+'"双重查询中运用?我的做法错在哪里?
我的做法:
Private Sub Command1_Click()
Dim sq As String
dim agm as string
tmp = Text1.Text
text2.text=sgm
label1.Caption = sgm
DataReport1.Show
End Sub
问题1、如何把窗体form1中的dim sgm as string,sgm=text2.text的内容赋给DataReport中的LABEL1.caption(或text2.text),以便打印出来。
问题2、把窗体form1中的变量 dim sq as string ,sq=text1.text,如何在dataenvironment1中的 sql=select * from dj,de where dj.wjdm=de.wjdm and wjdm="'+sq+'"双重查询中运用?我的做法错在哪里?
我的做法:
Private Sub Command1_Click()
Dim sq As String
dim agm as string
tmp = Text1.Text
text2.text=sgm
label1.Caption = sgm
DataReport1.Show
End Sub
datareport.sections.item(index).controls.item(index).caption=sgm
Private Sub Command5_Click(Cancel As Boolean)
On Error GoTo errIf quanxianjiancha("打印报表") = True Then'*********
'主要就是做一个假的记录集。然后将你的东西显示在rptLabel里
Dim rs As New ADODB.Recordset
rs.Fields.Append "Name", adVariant
rs.Open
Dim i As Integer
rs.AddNew
rs.Fields("Name").Value = "zhc"
rs.Update
Set rskp.DataSource = rs
With rskp.Sections.Item("Section1").Controls
.Item("rptbiaoti").Caption = ReadFromIni(App.Path & "\set.dat", "frmshezhi", "企业名称") & "职员卡片"
.Item("label90").Caption = "法人代表: " & ReadFromIni(App.Path & "\set.dat", "frmshezhi", "法人代表")
.Item("label91").Caption = "劳资主管: " & ReadFromIni(App.Path & "\set.dat", "frmshezhi", "劳资主管")
.Item("label90").Top = 14200
.Item("label91").Top = 14200
.Item("label92").Top = 14200
For i = 1 To 42
.Item("label" & i).Caption = Lab(i).Caption
.Item("label" & i).Top = i * 300 + 500
Next
For i = 43 To 84
.Item("label" & i).Caption = txt(i - 42).Text
.Item("label" & i).Top = (i - 42) * 300 + 500
.Item("label" & i).Left = 3000
Next
For i = 1 To 43
.Item("line" & i).Top = i * 300 + 430
.Item("line" & i).Width = 7550
Next
.Item("line60").Top = 730
.Item("line60").Left = 465
.Item("line60").Height = 42 * 300
.Item("line61").Top = 730
.Item("line61").Left = 8000
.Item("line61").Height = 42 * 300
End With
Dim pic As Picture
Dim rst As ADODB.Recordset
Dim bit1() As Byte
xx = "select 照片 from 照片库 where 序号=" & Val(Trim(txt(1).Text))
Set rst = chaxun(xx, yy)
If rst.RecordCount > 0 Then
If rst("照片").ActualSize > 0 Then
bit1 = rst.Fields("照片").GetChunk(rst("照片").ActualSize)
'然后将字节数组的内容拼装成文件即可
Open "c:\1.bmp" For Binary As #1
Put 1, 1, bit1
Close 1
Set pic = LoadPicture("c:\1.bmp")
Set rskp.Sections.Item("Section1").Controls.Item("Image1").Picture = pic
Kill ("c:\1.bmp")
End If
End If
rskp.Show 1
Else
MsgBox "无此权限", , "提示"
End If
Exit Sub
err:
MsgBox "程序出错,打印失败!", , "提示"
Set rs = Nothing
'Set rst = Nothing
End Sub不明白 [email protected]