vbasqlserver
Ⅰ VBA連接sqlSERVER時 老是彈出對話框提示選擇數據源
我是這樣做的
DataConn_S = "Provider=SQLOLEDB.1;User ID=xxxx;Password=xxxxx;Initial Catalog=TAP; Data Source=xxxxxxx"
Set DT = CreateObject("ADODB.Connection")
DT.Mode = adModeRead
DT.Open DataConn_S
Set RT = CreateObject("ADODB.Recordset")
SS = "select * from new_tap order by Material_Name"
RT.Open SS, DT
if not rt.eof then
sheet1.cells(1,1)=RT("field")
end if
RT.close
DT.close
Ⅱ vba 用ADO連接不上sqlserver 錯誤提示:client unable to establish connection
試試看
="DRIVER={SQL SERVER};SERVER=172.29.6.187;UID=xx;PWD=xxx"
Ⅲ vba access 將Access數據導入到sqlserver
吧sqlserver作為數據源,可以直接導的。你查查
docmd.exprot.......
Ⅳ VBA連接SQLServer的問題
給出報錯信息
Private Sub Form_Activate()
Dim conn As New ADODB.Connection
Dim cmd As New ADODB.Command
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Open basLogin.GetFurnaceDBPath, "admin", ""
Set cmd.ActiveConnection = conn
cmd.CommandText = "SELECT * FROM Slag_CAL order by DateTime "
rs.CursorLocation = adUseClient
rs.Open cmd, , adOpenStatic, adLockOptimistic
If rs.RecordCount > 0 Then
blnks = True
rs.MoveFirst
Timer1_Timer
End If
End Sub
還有就是不是那個語句寫錯。是你的連接不成功。問題是在連接執行語句上。
可能是沒有user這個表。還有就是游標沒有打開。還有就是連接不成功