08-11-2017 02:47 PM
Currently I have a VI that is writing and reading information from a SQL Server (Microsoft SQL Server 2016). If I'm practically writing and
consulting information (comparing if data is written, if not, save new data) from the 4 cursors, which one is the most recommended
to use: dynamic, forward-only, key-set or static.
At the moment I compiled the VI using the dynamic cursor in my queries. But I'm getting some weird timeout error (258). So I want to try
changing the cursor, if maybe that could help somehow.
Please help me with this matter, I would really appreciate it.
In advance; thanks a lot everyone.
Solved! Go to Solution.
08-11-2017 04:05 PM
I don't understand your question at all. Can you give an example of what you are trying to do and post a snippet of your code?
A cursor is not a required parameter to execute SQL statements. Are you certain that you need to use cursors?
08-11-2017 04:51 PM
Here are some screenshots of my code. For example:
I have been getting some weird error, so I'm going to try changing cursors at my queries.... I have no clue if this is going to affect in some way. But before doing so, I want to know if someone here in the forums has some tips, guidance of answer to my question:
Do you have experience, changing cursor and knowing the main difference between them? Pros and cons?
08-11-2017 05:02 PM
Like I said, you don't need a cursor just to select some values. I'm not really sure how cursors work because I have never used them. I think they allow you to scroll thru the values and see updates as they happen by other users. Seems to me that the overhead would be high to use them.
08-11-2017 05:17 PM - edited 08-11-2017 05:18 PM
Oh ok... I'm going to test changing the cursor to "forward-only", since in the HELP menu says it has the "best performance". Thanks for your
answer anyways
08-14-2017 11:00 AM
Forward-only appears to be the default cursor type. That input is not required so just leave it blank unless you want to use something different.
08-22-2017 08:00 AM
It seemed like at some point the intranet of the Company failed. The weird thing is that in the connection time out I have the default, up to 15 seconds... This didn't work, so what I did was the next logarithm:
1. If connection error appear while opening connection. I saved the whole query in .txt file.
2. The program kept going as normal and in the next cycle, when opening connection once again, I check if notepad has any queries:
- If it does, gets those queries and executes them.
- If not, opens connection and execute the current query.
3. Up to know, that has been my own solution.
Thanks for your support and comments anyways. I really appreciated it. By the way left the cursor as "forward only".