PDA

Click to See Complete Forum and Search --> : Insert New Record's and VB Pukes


twitchibob
Oct 6th, 2000, 01:06 PM
I click the button and Boom VB pops up with "Object or provider is not capable of performing this operation"

Please Help :-)

Twitch


Private Sub cmdInsert_Click()
Dim RSsql As New ADODB.Recordset
Dim connsql As ADODB.Connection

Set connsql = New ADODB.Connection

connsql.ConnectionTimeout = 25
connsql.Provider = "sqloledb"
connsql.Properties("Data Source").Value = "athome"
connsql.Properties("Initial Catalog").Value = "Logging"
connsql.Properties("User ID").Value = "graysonco"
connsql.Properties("Password").Value = "grayson"

connsql.Open

connsql.BeginTrans

RSsql.Open "SELECT * FROM SERVERADMINSERVERS", connsql

'when I debug it highlights RSsql.Addnew


RSsql.AddNew
RSsql.Fields("Server") = txtServer.Text
RSsql.Fields("IPAddress") = txtIP.Text
RSsql.Fields("HubPort") = txtHub.Text
RSsql.Fields("CPU") = txtCPU.Text
RSsql.Fields("HardDiskSize") = txtHDD.Text
RSsql.Fields("OS") = txtOS.Text
RSsql.Update

connsql.CommitTrans

RSsql.Close
Set RSsql = Nothing

connsql.Close

monte96
Oct 8th, 2000, 12:21 AM
Actually, VB is correct. Recordsets are by default adOpenForwardOnly and are read only.

Try this:

RSsql.Open "SELECT * FROM SERVERADMINSERVERS", connsql, adOpenKeyset


and don't forget to set your connection to nothing as well..