|
程序如下:请各位帮帮忙看看
Private Sub Refresh_Scores()
Set con = New ADODB.Connection
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\成绩管理.mdb;Persist Security Info=False"
con.CursorLocation = adUseClient
con.Open
Adodc1.ConnectionString = con
sql = "select 学生表.学号,学生表.姓名,成绩表.总评 from 成绩表,学生表,班级表 where 课程表.课程名称='" + Trim(DataCombo1.BoundText) + "'And 成绩表.学号=学生表.学号 And 学生表.班级编号=班级表.班级编号 And 班级表.班级名称='" + Trim(DataCombo2.BoundText) + "' Order By 总评 Desc"
Adodc1.RecordSource = sql
Set myRs = con.Execute(sql)----------------------到这里就说至少一个参数未定义
s = myRs.Fields.Count
Set DataGrid1.DataSource = myRs
For i = 0 To s - 1
DataGrid1.Columns(i).Alignment = dbgCenter
DataGrid1.Columns(i).Width = 1000
Next i
End Sub
Private Sub DataCombo1_Click(Area As Integer)
DataGrid1.SetFocus
Refresh_Scores
End Sub
Private Sub DataCombo2_Click(Area As Integer)
DataGrid1.SetFocus
Refresh_Scores
End Sub |
|