title image


Smiley Re: Noch einmal SQL Server und Access
Ja - die ADO-Connection kann ja z.B. den CommandType "adCmdStoredProc" haben - in der Hilfe ist auch ein Beispiel:Dim cnn1 As ADODB.ConnectionDim cmdByRoyalty As ADODB.CommandDim prmByRoyalty As ADODB.ParameterDim rstByRoyalty As ADODB.RecordsetDim rstAuthors As ADODB.RecordsetDim intRoyalty As IntegerDim strAuthorID As StringDim strCnn As String ' Define a command object for a stored procedure. Set cnn1 = New ADODB.Connection strCnn = "Provider=sqloledb;" & _ "Data Source=Sirius;Initial Catalog=pubs;User Id=sa;Password=xx; " cnn1.Open strCnn Set cmdByRoyalty = New ADODB.Command Set cmdByRoyalty.ActiveConnection = cnn1 cmdByRoyalty.CommandText = "byroyalty" cmdByRoyalty.CommandType = adCmdStoredProc cmdByRoyalty.CommandTimeout = 15 ' Define the stored procedure's input parameter. intRoyalty = Trim(InputBox("Enter royalty:")) Set prmByRoyalty = New ADODB.Parameter prmByRoyalty.Type = adInteger prmByRoyalty.Size = 3 prmByRoyalty.Direction = adParamInput prmByRoyalty.Value = intRoyalty cmdByRoyalty.Parameters.Append prmByRoyalty ' Create a recordset by executing the command. Set rstByRoyalty = cmdByRoyalty.Execute() ' Open the Authors table to get author names for display. Set rstAuthors = New ADODB.Recordset rstAuthors.Open "authors", strCnn, , , adCmdTable ' Print current data in the recordset, adding ' author names from Authors table. Debug.Print "Authors with " & intRoyalty & _ " percent royalty" Do While Not rstByRoyalty.EOF strAuthorID = rstByRoyalty!au_id Debug.Print , rstByRoyalty!au_id & ", "; rstAuthors.Filter = "au_id = '" & strAuthorID & "'" Debug.Print rstAuthors!au_fname & " " & _ rstAuthors!au_lname rstByRoyalty.MoveNext Loop rstByRoyalty.Close rstAuthors.Close cnn1.CloseReinhard


Gruß aus dem Norden
Reinhard


Bitte immer die Access-Version angeben!
DB-Wiki


Wie man Fragen richtig stellt

YaccessAccess-FAQUnd ansonsten: Wikipedia




geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: