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这个表。还有就是游标没有打开。还有就是连接不成功