嘿,我对VBA很新,我希望有人可以用最后一点代码帮助我.
我试图从电子表格中取出单元格并将它们添加到SQL表中,但我正在使用运行SQL语句的trubble.这是我到目前为止的代码.
Private Sub ConnectDB()
Dim oConn As Object
Set oConn = CreateObject("ADODB.Connection")
oConn.Open = "DRIVER={SQL Server};" & _
"SERVER=SERVER02;" & _
"DATABASE=platform;" & _
"USER=5y5t3mus3r;" & _
"PASSWORD=*******;" & _
"Option=3;"
If oConn.State = adStateOpen Then
MsgBox "Welcome to Database!"
Else
MsgBox "Sorry No Database Access."
End If
Dim rs As ADODB.Recordset
Dim strSQL As String
Dim Company As String
Dim Address As String
Dim Address1 As String
Dim Address2 As String
Dim County As String
Dim Contact As …Run Code Online (Sandbox Code Playgroud)