Привет. Ниже приведен мой код, я не могу получить данные с моего сервера SQL,
его ошибка броска как
Compiler error : object required.
Нет проблем с соединением, соединение успешно.
Пожалуйста, исправьте мой код, помогите мне с этим
Private Sub CommandButton1_Click()
Set SQLConn = CreateObject("ADODB.Connection")
SQLConn.Open "provider =sqloledb; Data Source = xxxx; Initial Catalog = jjjj; User Id = yyyy; Password = zzzz"
MsgBox "Connection Succesful"
Set SQLData = CreateObject("ADODB.Recordset")
With SQLData
' Assign the Connection object.
.ActiveConnection = SQLConn
' Extract the required records.
.Open "select invoice_num, invoice_date, invoice_amount from im_invoice where billing_account = 'HS0076A' and invoice_date ='01-apr-2011'"
' Copy the records into cell A1 on Sheet1.
Sheet1.Range("A1").CopyFromRecordset SQLData
' Tidy up
.Close
End With
SQLConn.Close
Set SQLData = Nothing
Set SQLConn = Nothing
End Sub
Спасибо
спасибо, что работает ....:)