0
' Create the Connection and Recordset objects.
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
Dim val As String
val = Range("B5").Value
' Open the connection and execute.
conn.Open sConnString
Dim item As String
item = "INSERT INTO [IndustrialComp].[dbo].[Header]("
item = item & " [server_name] "
item = item & " )Values("
item = item & " '" & val & "')"
conn.Execute item
上述代碼插入任何谷是在B5到SQL服務器08 DATABSE(industcomp)的表被稱爲報頭和名爲server_name collumn。從EXCEL將數據插入到DB
我基本上想要插入多個值到這個數據庫..三個collumns是server_name,phys和virt。
例如b5插入server_name .... c5插入物理... d5插入到virt中。
我需要聲明多個字符串還是有辦法基本列出值與相應的collumns列表?
感謝
太好了!感謝您的幫助 – user3013325