2

パラメータを受け取るストアドプロシージャがありますが、何も返しません。MS Access内から呼び出すにはどうすればよいですか?

編集-Remouの助けを借りて、私はそれを機能させました:

Set cnn = New adodb.Connection
cnn.ConnectionString = 
   "driver=SQL Server;server=SERVER\SERVER;database=a_db;Trusted_Connection=Yes"

cnn.Open cnn.ConnectionString

Set cmd = New adodb.Command
cmd.ActiveConnection = cnn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "stprMoveDataSet"

Set param = cmd.CreateParameter
                ("DataSetID", adInteger, adParamInput, 6, stDataSet)
cmd.Parameters.Append param
Set param = cmd.CreateParameter
                ("Destination", adChar, adParamInput, 2, stDestination)
cmd.Parameters.Append param

rs.CursorType = adOpenStatic
rs.CursorLocation = adUseClient
rs.LockType = adLockOptimistic
rs.Open cmd
4

1 に答える 1

4

Here is an outline that may help. I may be able to get back with more detail later. It is not specific to your case, but it may keep you going :)

Public dbconn As ADODb.Connection
Dim cmd As New ADODb.command
Dim rs As New ADODb.Recordset
Dim param As New ADODb.Parameter

Set dbconn = New ADODb.Connection
dbconn.ConnectionString = GetServerCon

dbconn.Open dbconn.ConnectionString

Set cmd = New ADODb.command
cmd.ActiveConnection = dbconn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "insert_user"

Set param = cmd.CreateParameter(_
   "username", adVarChar, adParamInput, 50, Environ("UserDomain") & "dddddddd\" _
   & Environ("Username"))
cmd.Parameters.Append param

rs.CursorType = adOpenStatic
rs.CursorLocation = adUseClient
rs.LockType = adLockOptimistic
rs.Open cmd
于 2012-09-13T12:29:17.530 に答える