請問,我是以這方式連上SQL SERVER的
Dim DB_Cn As New ADODB.Connection
Dim DB_COM As New ADODB.Command
Dim DB_Rs As New ADODB.Recordset
With DB_Cn
.Provider = "SQLOLEDB.1"
.ConnectionString = "Data Source = SQL_SERVER;" _
"INITIALCATALOG = TEST;" _
"USER ID = TEST;" _
"Password = TEST"
.CursorLocation = adUseClient
.Open
End With
DB_COM.ActiveConnection = DB_Cn
DB_COM.CommandType = adCmdText
DB_COM.CommandText = "SELECT * FROM 資料表"
DB_Rs.CursorType = adOpenDynamic
DB_Rs.LockType = adLockPessimistic
Set DB_Rs = DB_CoM.Execute
Set DataGrid1.DataSource = DB_Rs
但不知為何
DB_Rs.CursorType = adOpenStatic ===>這兩行的屬性都改變了
DB_Rs.CursorType = adLockReadOnly ===>為什麼?
另外,當我用 "Update .... "時, 如何讓DataGrid1也能更新呢?
另外,我的VB程式是在WIN98系統下做編輯, 如果將來要拿到
NT SERVER上, WORKSTATION為WIN98的環境,在WORKSTATION 能執行嗎?