Advertisement
Guest User

Untitled

a guest
Aug 18th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. public class SSRSReportsGenerator: MarshalByRefObject, ISSRSReports
  2. {
  3. // Creating Reporting Service Object.
  4. ReportingService2005 RS;
  5. public SSRSReportsGenerator()
  6. {
  7. RS = new ReportingService2005();
  8. RS.Credentials = System.Net.CredentialCache.DefaultCredentials;
  9. }
  10. public void CreateDataSource()
  11. {
  12. string name = "DataSource1";
  13. string parent = "/MTVN Reports";
  14.  
  15. // Define the data source definition.
  16. DataSourceDefinition definition = new DataSourceDefinition();
  17. RS.Credentials = System.Net.CredentialCache.DefaultCredentials;
  18. RS.UseDefaultCredentials= false;
  19.  
  20. definition.CredentialRetrieval = CredentialRetrievalEnum.Integrated;
  21. definition.UserName = "sa";
  22. definition.Password = "sa123";
  23. definition.ConnectString = "";
  24. definition.Enabled = true;
  25. definition.EnabledSpecified = true;
  26. definition.Extension = "DATASET";
  27. definition.ImpersonateUser = false;
  28. definition.ImpersonateUserSpecified = false;
  29. definition.Prompt = null;
  30. definition.WindowsCredentials = false;
  31.  
  32. try
  33. {
  34. RS.CreateDataSource(name, parent, true, definition, null); // Getting error on this line
  35. }
  36. catch (Exception e)
  37. {
  38. Console.WriteLine(e.Message);
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement