Solved

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

Posted on 2011-09-05
6
311 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 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

632 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