Solved

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

Posted on 2011-09-05
6
303 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
  • 3
  • 2
6 Comments
 
LVL 16

Assisted Solution

by:Easwaran Paramasivam
Easwaran Paramasivam earned 167 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 333 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
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 

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 333 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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Suggested Solutions

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

726 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