Excel 中调用SQL存储过程
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
posted on 2012-05-29 09:20 stone.amoi 阅读(2174) 评论(0) 编辑 收藏 举报