# 请教这个程式错在那里?

Posted by kkcheung on September 10, 1999 at 16:18:33:

selstr = "select * from sale_rec where sale_date like '" + Trim(T_FROM.Text) + "%'"

Set tempset = FMSDB.OpenRecordset(selstr, dbOpenSnapshot, dbSQLPassThrough)
If tempset.EOF Then
MsgBox "在指定条件下无查询资料 !", , FRM_KHGH_Q_P.Caption
MSG_BAR.Caption = ""
Exit Sub
End If
Do While Not tempset.EOF
temp_inv = Trim(tempset.Fields!invo_code): temp_lot = Trim(tempset.Fields!stockno)

selstr2 = "select * from receive_rec where stock_no='" + temp_lot + "'"
Set tempset2 = FMSDB.OpenRecordset(selstr2, dbOpenSnapshot, dbSQLPassThrough)

If Not tempset2.EOF Then
temp_sendcode = Trim(tempset2.Fields!send_code)
sqlSTR = "UPDATE sale_rec SET send_code= '" + temp_sendcode + "' WHERE invo_code='" + temp_inv + "' and stockno='" + temp_lot + "'"
BeginTrans
FMSDB.Execute sqlSTR, dbSQLPassThrough
End If

tempset.MoveNext
tempset2.Close
Loop
上面的程式可以顺利执行到第一次loop后,当第二次执行Set tempset2 = FMSDB.OpenRecordset(selstr2, dbOpenSnapshot, dbSQLPassThrough),就出现ODBC-call failed 3146.我作程式追踪,selstr2这句是完整的,抄到visdata亦可执行,但在这里却过了,请教问题出在那里.谢谢大家!

Follow Ups:

- Re: 请教这个程式错在那里? 阿拉 13:28:58 9/11/99 (1)
  - Re: 请教这个程式错在那里? kkcheung 16:17:18 9/13/99 (0)