VB6.0 问题,一直各种错误,求大神解答,在线等
PrivateSubCommand1_Click()DimcnAsADODB.ConnectionDimrsAsADODB.RecordsetDimstrCnnAsStr...
Private Sub Command1_Click()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strCnn As String
Dim Tname As String
Tname = Trim(T_name.Text)
'strCnn = "DRIVER={SQL SERVER};SERVER=XROS;UID=sa;PWD=sa;DATABASE=jiaoxuedb"
Set cn = New ADODB.Connection
cn.Open = ("DRIVER={SQL SERVER};SERVER=XROS;UID=sa;PWD=sa;DATABASE=jiaoxuedb")
strSQL = "select cname from tc,teacher,course where teacher.tno=tc.tno and"
tc.cno = course.cno And teacher.Tname = "+Tname+"""
Set rs = New ADODB.Recordset
rs.CursorType = adOpenStatic
rs.CursorLocation = adUseClient
Set rs = cn.Execute(strSQL)
Do While rs.EOF = False
List1.AddItem rs!cname
rs.MoveNext
Loop
Set rs = Nothing
cn.Close
Set cn = Nothing
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
代码与错误如图所示。。。求能在今晚内迅速解决 展开
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strCnn As String
Dim Tname As String
Tname = Trim(T_name.Text)
'strCnn = "DRIVER={SQL SERVER};SERVER=XROS;UID=sa;PWD=sa;DATABASE=jiaoxuedb"
Set cn = New ADODB.Connection
cn.Open = ("DRIVER={SQL SERVER};SERVER=XROS;UID=sa;PWD=sa;DATABASE=jiaoxuedb")
strSQL = "select cname from tc,teacher,course where teacher.tno=tc.tno and"
tc.cno = course.cno And teacher.Tname = "+Tname+"""
Set rs = New ADODB.Recordset
rs.CursorType = adOpenStatic
rs.CursorLocation = adUseClient
Set rs = cn.Execute(strSQL)
Do While rs.EOF = False
List1.AddItem rs!cname
rs.MoveNext
Loop
Set rs = Nothing
cn.Close
Set cn = Nothing
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
代码与错误如图所示。。。求能在今晚内迅速解决 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询