2
次のVBAコードがあります。この質問のタイトルにエラーメッセージが表示されています。誰でも助けてくれますか?VBAがSQL Serverのデータソース名に接続されていないため、デフォルトのドライバが指定されていませんか?
Sub Save_To_DB()
'Declare some variables
Dim cnn As ADODB.Connection
Dim cmd As ADODB.Command
Dim strSQL As String
'Create a new Connection object
Set cnn = New ADODB.Connection
'Set the connection string
cnn.ConnectionString = "Server=server_name;Database=database_name;Trusted_Connection=True;"
'Open the Connection to the database
cnn.Open **<-THE ERROR THROWS HERE**
'Create a new Command object
Set cmd = New ADODB.Command
'Associate the command with the connection
cmd.ActiveConnection = cnn
'Go on to write the SQL statement and execute
EDIT:[OK]を、私はそれを解決し、接続文字列でDriver={SQL Native Client};
を含めるために必要な、私は通常、このコードの並べ替えを書いてはいけません。
こんにちはRemou、私はそのウェブサイトの使用が、そこそれを指定する方法が非常に異なるようです。あなたが知っている作品の小さな例を挙げることができますか? – mezamorphic
SQLサーバーへの接続文字列が機能しません。自分のサーバーに関する情報を知っておく必要がありますが、ここに公開することはお勧めできません。しかし、私は私の答えにメモを追加します。 – Fionnuala