Integration Your Way - (800) 235-7250
RSSBus ADO.NET Provider for SharePoint
Questions / Feedback? Calling Stored Procedures

Calling Stored Procedures

You can invoke a stored procedure using SharePointCommand in the same way as any other SQL stored procedure. To instantiate a SharePointCommand, provide the name of the stored procedure and a SharePointConnection instance as arguments to the constructor. Set the CommandType property to StoredProcedure and add the parameters as key-value pairs to the Parameters collection of the SharePointCommand instance.


string connectionString = "user=myuseraccount;password=mypassword;URL=http://sharepointserver/mysite;Offline=false;";
SharePointConnection conn = new SharePointConnection(connectionString);
SharePointCommand cmd = new SharePointCommand("DownloadDocument", connection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SharePointParameter("@File", "MyFile.txt"));
// Add other parameters as needed ...

SharePointDataReader rdr = cmd.ExecuteReader();
while (rdr.Read()) {
  for (int i = 0; i < rdr.FieldCount; i++) {
    Console.WriteLine(rdr.GetName(i) + " --> " + rdr[i]);
  }
  Console.WriteLine();
}


 
Copyright © 2013 RSSBus Inc.
[x] close

Questions / Feedback?


Name:
Email:
Feedback:
Send Feedback