我的環境是 VB6.0 + SP4 + Access 2000 的資料庫,
我的問題如下:
我在 Form 上放置了 Adodc 及 Datagrid 及 6 個按鈕及 四個 Text 元件, 設定了如下的程式
Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\winuas\UASDATA.mdb;Persist Security Info=False"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "SELECT * FROM user
ORDER BY user_no"
Set DataGrid1.DataSource = Adodc1
Adodc1.Refresh
End Sub
'
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 0
Adodc1.Recordset.MoveFirst
Case 1
Adodc1.Recordset.MovePrevious
Case 2
Adodc1.Recordset.MoveNext
Case 3
Adodc1.Recordset.MoveLast
Case 4
Adodc1.Recordset.Delete
Case 5
Adodc1.Recordset.AddNew
Adodc1.Recordset("user_no") = Text1
Adodc1.Recordset("user_name") = Text2
Adodc1.Recordset("user_addr") = Text3
Adodc1.Recordset("user_tel") = Text4
Adodc1.Recordset.Update
Adodc1.Refresh
End Select
End Sub
問題如下:
為何新增的資料不會按照 order by 的順序顯示在 DataGrid 中,
而是跑到最後面去了呢 ?
謝謝 !!