Sign In Help
Schneider Electric
HelpSign In
Schneider Electric Exchange
  • Home
  • Collaborate
  • Develop
  • Shop
Home Collaborate Develop Shop Log in or Register Help

Invite a Co-worker

Send a co-worker an invite to the Exchange portal.Just enter their email address and we’ll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send Invite Cancel

Invitation Sent

Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Send New Invite Close
  • Home
  • Collaborate
  • Exchange Community
  • :
  • SCADA & Telemetry Solutions
  • :
  • Geo SCADA Expert Forum
  • :
  • [Imported] C# How to get a list of the SQL tables
Community Menu
  • Forums
    • By Topic
        • EcoStruxure IT
          • EcoStruxure IT forum
        • Industrial Automation
          • Industry Automation and Control Forum
          • Alliance System Integrators Forum
          • Machine Solutions in the Digital Transformation
          • EcoStruxure Automation Expert / IEC 61499 Forum
          • Industrial Edge Computing Forum
          • Level and Pressure Instrumentation Forum
          • Modicon User Group
          • PLC Club Indonesia
          • SEE Automation Club Forum
          • Fabrika ve Makina Otomasyonu Çözümleri
          • Форум по промышленной автоматизации СНГ
        • SCADA & Telemetry Solutions
          • Geo SCADA Expert Forum
          • SCADA and Telemetry Devices Forum
        • Power Distribution IEC
          • Power Distribution and Digital
          • Power Standards & Regulations
          • Paneelbouw & Energie Distributie
        • Power Distribution Softwares
          • EcoStruxure Power Design Forum
          • SEE Electrical Building+ Forum
          • LayoutFAST User Group Forum
        • Wireless Information Network Solutions
          • Instrument Area Network
          • Remote Monitoring
          • Tank Level Monitoring
          • Remote Data Collection
        • Solutions for your Business
          • Solutions for Food & Beverage Forum
          • Solutions for Healthcare Forum
    • By Segment
        • Food & Beverage
          • Solutions for Food & Beverage Forum
        • Healthcare
          • Solutions for Healthcare Forum
      • EcoStruxure IT
        • EcoStruxure IT forum
      • Industrial Automation
        • Industry Automation and Control Forum
        • Alliance System Integrators Forum
        • Machine Solutions in the Digital Transformation
        • EcoStruxure Automation Expert / IEC 61499 Forum
        • Industrial Edge Computing Forum
        • Level and Pressure Instrumentation Forum
        • Modicon User Group
        • PLC Club Indonesia
        • SEE Automation Club Forum
        • Fabrika ve Makina Otomasyonu Çözümleri
        • Форум по промышленной автоматизации СНГ
      • SCADA & Telemetry Solutions
        • Geo SCADA Expert Forum
        • SCADA and Telemetry Devices Forum
      • Power Distribution IEC
        • Power Distribution and Digital
        • Power Standards & Regulations
        • Paneelbouw & Energie Distributie
      • Power Distribution Softwares
        • EcoStruxure Power Design Forum
        • SEE Electrical Building+ Forum
        • LayoutFAST User Group Forum
      • Wireless Information Network Solutions
        • Instrument Area Network
        • Remote Monitoring
        • Tank Level Monitoring
        • Remote Data Collection
      • Solutions for your Business
        • Solutions for Food & Beverage Forum
        • Solutions for Healthcare Forum
      • Food & Beverage
        • Solutions for Food & Beverage Forum
      • Healthcare
        • Solutions for Healthcare Forum
  • Blogs
    • By Topic
        • Industrial Automation
          • Industrial Edge Computing Blog
          • Industry 4.0 Blog
          • Industrie du Futur France
        • SCADA & Telemetry Solutions
          • SCADA and Telemetry Blog
        • Power Distribution IEC
          • Power Events & Webinars
          • Power Foundations Blog
        • Power Distribution NEMA
          • NEMA Power Foundations Blog
        • Power Distribution Softwares
          • EcoStruxure Power Design Blog
          • SEE Electrical Building+ Blog
        • Solutions for your Business
          • Solutions for Food & Beverage Blog
          • Solutions for Healthcare Blog
          • Solutions for Retail Blog
        • Community experts & publishers
          • Publishers Community
    • By Segment
        • Food & Beverage
          • Solutions for Food & Beverage Blog
        • Healthcare
          • Solutions for Healthcare Blog
        • Retail
          • Solutions for Retail Blog
      • Industrial Automation
        • Industrial Edge Computing Blog
        • Industry 4.0 Blog
        • Industrie du Futur France
      • SCADA & Telemetry Solutions
        • SCADA and Telemetry Blog
      • Power Distribution IEC
        • Power Events & Webinars
        • Power Foundations Blog
      • Power Distribution NEMA
        • NEMA Power Foundations Blog
      • Power Distribution Softwares
        • EcoStruxure Power Design Blog
        • SEE Electrical Building+ Blog
      • Solutions for your Business
        • Solutions for Food & Beverage Blog
        • Solutions for Healthcare Blog
        • Solutions for Retail Blog
      • Community experts & publishers
        • Publishers Community
      • Food & Beverage
        • Solutions for Food & Beverage Blog
      • Healthcare
        • Solutions for Healthcare Blog
      • Retail
        • Solutions for Retail Blog
  • Ideas
        • Industrial Automation
          • Modicon Ideas & new features
        • SCADA & Telemetry Solutions
          • Geo SCADA Expert Ideas
          • SCADA and Telemetry Devices Ideas
  • Knowledge Center
    • Building Automation Knowledge Base
    • Industrial Automation Knowledge Base
    • Industrial Automation How-to videos
    • SCADA & Telemetry Solutions Knowledge Base
    • Digital E-books
    • Success Stories Corner
    • Power Talks
  • Events & Webinars
    • Innovation Talks
    • Innovation Summit
    • Let's Exchange Series
    • Technology Partners
  • Support
    • Ask Exchange
    • Leaderboard
    • Our Community Guidelines
    • Community User Guide
    • How-To & Best Practices
    • More
Join Now
How can we help?
cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
50943members
Join Now
244940posts
Join Now

[Imported] C# How to get a list of the SQL tables

Options
  • Subscribe to RSS Feed
  • Mark Topic as New
  • Mark Topic as Read
  • Float this Topic for Current User
  • Bookmark
  • Subscribe
  • Mute
  • Printer Friendly Page
Solved Go to Solution
Back to Geo SCADA Expert Forum
Solved
sbeadle
Sisko sbeadle Sisko
Sisko
‎2019-11-06 06:35 AM
0 Likes
1
387
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content
‎2019-11-06 06:35 AM

[Imported] C# How to get a list of the SQL tables

>>Message imported from previous forum - Category:Scripts and Tips<<
User: geoffpatton, originally posted: 2019-01-17 20:40:57 Id:350
We are making a C# program to retrieve some history using SQL Queries through a ODBC connection.
We want to be able to read into our program the Historic View tables so the user can make a selection of which View to use.

We have the Select statements working so the connection is good. We have not gotten anywhere figuring out getting the list of tables.

QueryPad will give us this list when we put this in it
?TABLES HistoricView %

Anyone done this before?

Solved! Go to Solution.

Labels
  • SCADA
Share
Reply

Accepted Solutions
sbeadle
Sisko sbeadle Sisko
Sisko
‎2019-11-06 06:35 AM
0 Likes
0
386
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content
‎2019-11-06 06:35 AM

Re: [Imported] C# How to get a list of the SQL tables

>>Responses imported from previous forum


Reply From User: tfranklin, posted: 2019-01-17 21:32:25
I've never successfully pulled these from a query against ClearSCADA, but you can definitely get the information if you pull it out of the registry using something like reg query.


Reply From User: geoffpatton, posted: 2019-01-17 21:32:29
We found what we needed. Just the first time we tried this we did something wrong.
_conn.GetSchema("Tables")

public IList ListTables()
{
List tables = new List();
DataTable dt = _connection.GetSchema("Tables");
foreach (DataRow row in dt.Rows)
{
string tablename = (string)row[2];
tables.Add(tablename);
}
return tables;
}

Edit: I should give credit to where we found this.
https://stackoverflow.com/questions/3005095/can-i-get-name-of-all-tables-of-sql-server-database-in-c...


Reply From User: BevanWeiss, posted: 2019-01-21 20:25:23
If you're using an ODBC connection then you can also pass in filters to the GetSchema call..
.GetSchema("Tables", new string[] { null, "HistoricView" }) will retrieve just the historic views.

If anyone knows a way to do this using the .NET API instead of the ODBC connections I would be very greatful to hear about it.


Reply From User: geoffpatton, posted: 2019-01-22 00:19:13
Thanks Bevan, I'll pass this on and we will see if we like one way over the other. For this program we intend on using it with more than one version so we specifically did not want to use the API. For the API you usually have to update the dlls and recompile to match the version of ClearSCADA. That can be a pain especially now with the monthly updates.


Reply From User: BevanWeiss, posted: 2019-01-22 20:24:33
Hi Geoff,
There's only really two versions (for both the .NET API and the Automation Interface)... Pre-2014R1, and =2014R1

So for the first version, you just use 2013R2.2 DLLs and it supports pretty much everything until 2017R2 when the Secure Connection was enabled by default.
For the later versions you use the latest DLLs (2017R3) to ensure optimum support.

We have a product we sell (an Add-In for Excel which allows easy access to ClearSCADA data via Excel formulas) which uses the .NET API and haven't had any issues with compatibility (beyond those listed at the start of this message).


Reply From User: geoffpatton, posted: 2019-01-23 02:00:03
Bevan,
Hum I know we have some programs and drivers that we always have to update. We must be using some other dlls also or something.
Our main programmer passed away last year so while we have the code he created (well most of it) we still lost the knowledge of why he did some things. Also his commenting was about zero.

I only dabble in the C# programming I mostly stay in the SCADA systems we work with. Our current main programmer is still learning some of those things and we have a few products he works on other than ClearSCADA programs. He also does all our heavy lifting SQL stuff.


Reply From User: BevanWeiss, posted: 2019-01-24 19:41:36
Things that use the Simple DDK are a different story, and annoyingly they do need to be recompiled with each version.
But the 'client access' DLLs are as I described above.

Who needs code comments anyway 😛
We find that C# is the easiest language to develop in, the very minor performance impact isn't really important anymore, and the ease of coding and reduction in memory management 'bugs' is awesome. It is a great programming language.


Reply From User: geoffpatton, posted: 2019-01-25 18:15:15
Ah yes the simple DDK rings a bell.
I try to comment code but I sometimes forget to. When your up against a deadline commenting becomes less important.

See Answer In Context

Share
Reply
  • All forum topics
  • Previous Topic
  • Next Topic
1 Reply 1
sbeadle
Sisko sbeadle Sisko
Sisko
‎2019-11-06 06:35 AM
0 Likes
0
387
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content
‎2019-11-06 06:35 AM

Re: [Imported] C# How to get a list of the SQL tables

>>Responses imported from previous forum


Reply From User: tfranklin, posted: 2019-01-17 21:32:25
I've never successfully pulled these from a query against ClearSCADA, but you can definitely get the information if you pull it out of the registry using something like reg query.


Reply From User: geoffpatton, posted: 2019-01-17 21:32:29
We found what we needed. Just the first time we tried this we did something wrong.
_conn.GetSchema("Tables")

public IList ListTables()
{
List tables = new List();
DataTable dt = _connection.GetSchema("Tables");
foreach (DataRow row in dt.Rows)
{
string tablename = (string)row[2];
tables.Add(tablename);
}
return tables;
}

Edit: I should give credit to where we found this.
https://stackoverflow.com/questions/3005095/can-i-get-name-of-all-tables-of-sql-server-database-in-c...


Reply From User: BevanWeiss, posted: 2019-01-21 20:25:23
If you're using an ODBC connection then you can also pass in filters to the GetSchema call..
.GetSchema("Tables", new string[] { null, "HistoricView" }) will retrieve just the historic views.

If anyone knows a way to do this using the .NET API instead of the ODBC connections I would be very greatful to hear about it.


Reply From User: geoffpatton, posted: 2019-01-22 00:19:13
Thanks Bevan, I'll pass this on and we will see if we like one way over the other. For this program we intend on using it with more than one version so we specifically did not want to use the API. For the API you usually have to update the dlls and recompile to match the version of ClearSCADA. That can be a pain especially now with the monthly updates.


Reply From User: BevanWeiss, posted: 2019-01-22 20:24:33
Hi Geoff,
There's only really two versions (for both the .NET API and the Automation Interface)... Pre-2014R1, and =2014R1

So for the first version, you just use 2013R2.2 DLLs and it supports pretty much everything until 2017R2 when the Secure Connection was enabled by default.
For the later versions you use the latest DLLs (2017R3) to ensure optimum support.

We have a product we sell (an Add-In for Excel which allows easy access to ClearSCADA data via Excel formulas) which uses the .NET API and haven't had any issues with compatibility (beyond those listed at the start of this message).


Reply From User: geoffpatton, posted: 2019-01-23 02:00:03
Bevan,
Hum I know we have some programs and drivers that we always have to update. We must be using some other dlls also or something.
Our main programmer passed away last year so while we have the code he created (well most of it) we still lost the knowledge of why he did some things. Also his commenting was about zero.

I only dabble in the C# programming I mostly stay in the SCADA systems we work with. Our current main programmer is still learning some of those things and we have a few products he works on other than ClearSCADA programs. He also does all our heavy lifting SQL stuff.


Reply From User: BevanWeiss, posted: 2019-01-24 19:41:36
Things that use the Simple DDK are a different story, and annoyingly they do need to be recompiled with each version.
But the 'client access' DLLs are as I described above.

Who needs code comments anyway 😛
We find that C# is the easiest language to develop in, the very minor performance impact isn't really important anymore, and the ease of coding and reduction in memory management 'bugs' is awesome. It is a great programming language.


Reply From User: geoffpatton, posted: 2019-01-25 18:15:15
Ah yes the simple DDK rings a bell.
I try to comment code but I sometimes forget to. When your up against a deadline commenting becomes less important.

See Answer In Context

Share
Reply
Related Products
Schneider Electric
EcoStruxure™ Geo SCADA Expert
Top Experts
User Count
sbeadle
Sisko sbeadle Sisko
188
BevanWeiss
Admiral BevanWeiss
51
AdamWoodland
Lt. Commander AdamWoodland Lt. Commander
16
JChamberlain
Lieutenant JChamberlain Lieutenant
16
AndrewScott
Lieutenant AndrewScott
14
See More Top Experts
Find a Service Provider
Find a certified partner to help you address your integration, installation, maintenance and project needs.
View all Providers
Support

Have a question? Please contact us with details, and we will respond.

Contact Us
FAQ

Look through existing questions to find popular answers.

Learn More
About

Want to know more about Exchange and its possibilities?

Learn More

Full access is just steps away!

Join Exchange for FREE and get unlimited access to our global community of experts.

Connect with Peers & Experts

Discuss challenges in energy and automation with 30,000+ experts and peers.

Get Support in Our Knowledge Base

Find answers in 10,000+ support articles to help solve your product and business challenges.

Ask Questions. Give Solutions

Find peer based solutions to your questions. Provide answers for fellow community members!

Register today for FREE

Register Now

Already have an account?Log in

About Us FAQ Terms & Conditions Privacy Notice Change your cookie settings
©2020, Schneider Electric