Dim CN As New ADODB.Connection Dim iCmd As ADODB.Command Const conn = "Provider = SQLOLEDB;" & _ "Data Source = ip;" & _ "Initial Catalog = storeDB;User ID =sa;Password = pw;" CN.Open conn
Set iCmd = New ADODB.Command With iCmd .ActiveConnection = CN .CommandTimeout = 120 .CommandType = adCmdStoredProc .CommandText = "upd_yf_instore_by_styleNo" .Parameters.Refresh .Parameters("@styleNo") = Sheet1.Range("B" + Trim(Str(i))).Value .Parameters("@qty") = Sheet1.Range("C" + Trim(Str(i))).Value .Execute End With