| |

VerySource

 Forgot password?
 Register
Search
View: 917|Reply: 4

Help: How to straighten out this sentence ???

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-19 18:30:01
| Show all posts |Read mode
The procedure is as follows: Please help
Private Sub Refresh_Scores ()
Set con = New ADODB.Connection
con.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source =" + App.Path + "\Grade Management.mdb; Persist Security Info = False"
con.CursorLocation = adUseClient
con.Open
Adodc1.ConnectionString = con
sql = "select student table. student number, student table. name, transcript. general evaluation from transcript, student table, class table where course table. course name = '" + Trim (DataCombo1.BoundText) + "' And transcript .Student Number = Student Table. Student Number And Student Table. Class Number = Class Table. Class Number And Class Table. Class Name = '"+ Trim (DataCombo2.BoundText) +"' Order By General Comment Desc "
Adodc1.RecordSource = sql

Set myRs = con.Execute (sql) --------------- At this point, at least one parameter is undefined
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
Reply

Use magic Report

0

Threads

16

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-4-27 20:30:01
| Show all posts
Set myRs = con.Execute (sql) ---------------------- At this point, at least one parameter is undefined
maybe
sql = "select student table. Student ID, student table. Name, score table. General comment from score table, student table, class table where course table. Course name = '" + Trim (DataCombo1.BoundText) + "' And score table .Student ID = student list.Student ID And student list. Class number = class list.Class number And class list. Class name = '"+ Trim (DataCombo2.BoundText) +"' Order By General Review Desc "
With you

Score management.mdb

No correspondence
Reply

Use magic Report

0

Threads

9

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-4-27 23:15:01
| Show all posts
Add a line below sql = "......":
debug.print sql
See if SQL is right
Reply

Use magic Report

0

Threads

10

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-4-28 03:00:01
| Show all posts
from transcript, student table, class table where course table. Course name

It ’s obvious when you see this error. Where did the curriculum come from? ?

You directly go to the access query to build the SQL statement and use it in the program.
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 France

 Author| Post time: 2020-5-1 01:45:01
| Show all posts
In fact, I mean I want to use DataCombo1 and DataCombo2, where DataComb1 is used to display the course name, DataCombo2 is used to display the class name, when these two are selected, the results I want are displayed in DataGrid1, but I tied Can't fix DataCombo, alas, so annoying
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list