After each time you have finished, it is useless for N for a long time. If you solve it, you will be remembering this time. Next time, you will definitely encounter, as long as you are not familiar, you can find it. :) 1. Exect clause, if it is a number (whole, floating), then don't have to add single quotes, namely Dim Paracmd = New OLEDBCommand ("Select * from setit where id = 6", conn) is a string, then Must add cmd = new oledbcommand ("Select Distinct Subject from Subject Where Grade = '" Session ("Grade") "'", CONN)
2. Child query tone should not forget the plus (), max () function returns to use =, or IN is the same, DIM Paracmd = New OLEDBCOMMAND ("SELECT * from setit where id in (SELECT * FROM Setit ", conn)
Dim paraacmd = new oledbcommand ("Select * from setit where id = (Select Max (ID) from setit", conn
3. Insert the number to string, then VALUES ('ABC'), inserts a string identifier, inserting a number for Values (11.1) or VALUES ('11 .1 ') Both, digital identifiers, for Values ('"& Diglabel &"), "& ... &" is used by the identifier of the resolution ...' 'input parameters for SQL statements CMD = New OLEDBCOMMAND ( Insert INTO Setit (A, B, C, Head, Tail) Values ('"& TextBox1.text &",' "& TextBox2.text &", '"& TextBox3.Text &"' "& TextBox4.text & "'" "& textBox5.text &") ", conn)
4. The table name is not, set, the column name is valued, called Effect, you can .. fainting .... why? Wrong ... I found a mistake for more than an hour, just One ",", really fainting, no wonder will have the above mistake ... cmd = new oledbcommand ("INSERT INTO Score (Effect), Values (11)", CONN) Error CMD = New OLEDBCOMMAND (" INSERT INTO Score (Effect) Values (11) ", conn) 'is just right, no, it is correct, you must remember.
5.count can not be used as a column name, halo, change to allscore, you can go .... Weird, string will also resolve keywords ~~ Well, the name of the name cannot be a non-ordinary ..
6. OLDBDataReader can only keep one and database connections, if there are more than two, you must turn off other talents .7. Three or four mistakes have been made, write from Form ........ .. Then I checked it half an hour ... faint ..
8. DataGrid is set to DataSource must then DATABIND can display correctly.