关于Label显示数据库字段的问题
请先看这段代码:
If KeyAscii = 13 Then
Dim str As String
Dim str1 As String
Dim rs As ADODB.Recordset
str = "select max(bed_no) from BED_REC where WARD_CODE= '030809 ' "
Set rs = ExecuteSQL(str, True)
If rs.Fields(0) < Int(Text1.Text) Then '输入的床位号大于最大床位号,则符合床位要求,可以查看该床位是否有病人
MsgBox "没有该床位号,请重新输入! ", vbOKOnly + vbExclamation, "注意 "
Exit Sub
End If
End If
str1 = "select t1.NAME,t1.PATIENT_ID,t1.SEX,t1.INP_NO,t1.CHARGE_TYPE,t2.BED_NO,t2.PREPAYMENTS, " _
& "t2.ADMISSION_DATE_TIME,t2.DEPT_CODE,t2.NURSING_CLASS,t2.DIAGNOSIS,t2.PATIENT_ID, " _
& "t2.PATIENT_CONDITION,t2.ADM_WARD_DATE_TIME,t2.OPERATING_DATE,t2.DOCTOR_IN_CHARGE " _
& "from PAT_MASTER_INDEX t1,PATS_IN_HOSPITAL t2 " _
& "where t1.PATIENT_ID=t2.PATIENT_ID and t2.WARD_CODE= '030809 ' "
Set rs = ExecuteSQL(str1, True)
Label20.Caption = rs.Fields(0)
我就是想在Label20中显示出所查出来的字段,但是一运行就错误提示说“未找到预期FROM关键字”
请问怎么办???谢谢
[解决办法]
t2.DOCTOR_IN_CHARGE " _
& "from
应该是
t2.DOCTOR_IN_CHARGE " _
& " from
有空格
下边where也有这问题