OleDbDataConnection.DesignExt.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Data;
  5. using System.Data.Common;
  6. using System.Data.OleDb;
  7. using FastReport.Utils;
  8. using FastReport.Forms;
  9. using FastReport.Data.ConnectionEditors;
  10. namespace FastReport.Data
  11. {
  12. partial class OleDbDataConnection
  13. {
  14. private void GetDBObjectNames(string name, List<string> list)
  15. {
  16. DataTable schema = null;
  17. DbConnection conn = GetConnection();
  18. try
  19. {
  20. using (OleDbCommandBuilder builder = new OleDbCommandBuilder())
  21. {
  22. OpenConnection(conn);
  23. schema = conn.GetSchema("Tables", new string[] { null, null, null, name });
  24. foreach (DataRow row in schema.Rows)
  25. {
  26. string tableName = row["TABLE_NAME"].ToString();
  27. string schemaName = row["TABLE_SCHEMA"].ToString();
  28. if (String.IsNullOrEmpty(schemaName))
  29. list.Add(tableName);
  30. else
  31. list.Add(schemaName + "." + builder.QuoteIdentifier(tableName, conn as OleDbConnection));
  32. }
  33. }
  34. }
  35. finally
  36. {
  37. DisposeConnection(conn);
  38. }
  39. }
  40. /// <inheritdoc/>
  41. public override int GetDefaultParameterType()
  42. {
  43. return (int)OleDbType.VarChar;
  44. }
  45. /// <inheritdoc/>
  46. public override ConnectionEditorBase GetEditor()
  47. {
  48. return new OleDbConnectionEditor();
  49. }
  50. /// <inheritdoc/>
  51. public override string GetConnectionId()
  52. {
  53. return "OleDb: " + ConnectionString;
  54. }
  55. }
  56. }