Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB.NET - MSSQL EXPRESS... save data on trigg..

Posted on 2011-09-05
6
Medium Priority
?
319 Views
Last Modified: 2012-05-12
Hello.
I have done a application that´s saves data from PLC to MSSQL whit a PC-VB.NET solution.

What I have done is that I have made some tags in a OPC-Server and then on trigg I just save the actual value in the tag(PLC-tag OPC-Server) and then save it into a database. ex. MSSQL with my vb.net application...

This application works verry well. I save one value every 5 min... for ex 8 hours... (workday)

Now to my question.

I would like to save data every 5 sec from PLC into the database...
Now I want some tips in wich way I do this best.
Should I stll read the tags every 5 sec and then direcly write to the database or should I read the values in a dataset in VB and then do a big send after a time?

I pretty new at this so thats why I want some tips...

I hope someone understand my question...


0
Comment
Question by:kavvis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 16

Assisted Solution

by:Easwaran Paramasivam
Easwaran Paramasivam earned 501 total points
ID: 36483468
Create a windows service application. In that use Timer and set the interval of 5 sec. Refer the links.

http://www.codeproject.com/KB/dotnet/simplewindowsservice.aspx.
http://www.developer.com/net/net/article.php/3335731/Using-Timers-in-a-Windows-Service.htm

0
 

Author Comment

by:kavvis
ID: 36485688
hi! think I didn't explain My task correct, I still would like to use vb.net applikation that I have already, what I would like to know is.
Should I write a whole  query to MSSQL every 5 sec or should I Save in for example The values in à data set and then send many values at The same time!!?
0
 

Accepted Solution

by:
michael_krell earned 999 total points
ID: 36487957
With the PLC Data Collection Apps that i have created that is the approach i have taken. I am not sure what data you are grabbing, but last time i did this i had data in the PLC organized by an array of a user defined datatype. I had arrays in the plc i called buffers. when they filled up with data the vb service would be triggered to grab that batch of data and insert that entire batch of data into SQL.

This works well because if communication is lost, the PLC will store the data until communication is regained.
0
Tutorials alone can't teach real engineering

So we built better training tools.

-Hands-on Labs
-Instructor Mentoring
-Scenario-Based Tests
-Dedicated Cloud Servers

All at your fingertips. What are you waiting for?

 

Author Comment

by:kavvis
ID: 36488075
Yes, that´s a god way to do this task. But in my case I have no change to change the PLC software, I only can read some tags from a OPC-Server.

The read it´s selves is no problem.. I just wunder with ways is the best...

It´s about 40 diffrent tags I would like to read every 5 sec, I can do like I already does but I´m not sure that thats the best way...

Now I read 40 tags and then direcly save these tags in the MSSQL.... maybe I should still do like this..
or should I save the values in a dataset and then send it after tex. 10min instead....  
0
 

Assisted Solution

by:michael_krell
michael_krell earned 999 total points
ID: 36535661
if you have no method of writing back to let the data source know you already have the data you are better of doing it the way you are doing it. ideally it would be good to have 2 way communication. it will open up other opportunities.

i can elaborate further if you want.
0
 

Author Closing Comment

by:kavvis
ID: 36535879
Thank you for yopu took your time.. I do as have done before... thank  you
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question