最近几个月稳定工作的代码现在已停止工作。我们推出的任何产品都没有升级(Windows或其他)。无法通过Excel连接到SQL Server 2008 VB7
下面的代码将数据推到一个SQL Server 2008数据库:
Dim db As New ADODB.Connection
''#Other data manipulation not shown
With db
''#On Error Resume Next ''# With or without this line I still get no indication of the error
.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Data Source=myDB;" & _
"Use Procedure for Prepare=1;Auto Translate=True; Packet Size=4096; Use Encryption for Data=True;" & _
"Tag with column collation when possible=false;Initial Catalog=SFM_market"
.Open
.Execute query
.Close
End With
的数据库状态字段读0次。这是我的理解,它应该读1当它已成功连接。
我最近还重新考虑将ADODB.Command与ADODB.Connection一起使用,但最终结果是相同的。状态字段保持为0.我没有遇到任何错误,数据根本不会进入数据库,因为没有建立连接。
任何想法,为什么这可能是?
您将不会收到错误消息,其中包含错误继续下一步潜伏 - 请先尝试删除,以便您可以看到发生了什么问题。 – gibeath
感谢您指出这一点,遗憾的是它并没有提供任何进一步的洞察力。 – BOMEz
在那之后你有没有收到任何类型的错误信息? – gibeath