我正在使用sql server 2005在vb6中編寫一個應用程序。這裏是我當前的代碼。VB6語法問題,「沒有當前記錄」錯誤
Dim Sqlstring As String
Dim rstCurrentTicket As Recordset
Sqlstring = "Select SubmiterName, LastViewDate, Department, Description, Urgency, SubmitDate, ResolvedDate from TroubleTickets where Title ='" + Trim(TicketComboBox.Text) + "'"
Set rstCurrentTicket = cnnSel.OpenRecordset(Sqlstring)
NameText.Text = rstCurrentTicket!SubmiterName
DeptText.Text = rstCurrentTicket!Department
Me.DescriptionText = rstCurrentTicket!Description
Me.UrgencyText = rstCurrentTicket!Urgency
當我運行此代碼我收到一個錯誤代碼說:
「運行時錯誤:‘3021’」 「沒有當前記錄」
,它突出了這行代碼:
NameText.Text = rstCurrentTicket!SubmiterName
如何解決這個問題的任何建議?
檢查是否已確認您的SQL語句實際返回的結果嗎? –