Concurrency Control And Locks In Multithreading?
Apr 14, 2010
i understand that web service creates its own sessions so thats no problem to multi-thread. but i am writing my results into the database and files. how to do i do my concurrency control for writing into file and database here, can i do it on my calling app which is a console app or i will have to do it in my web service. i am not returning anything to the calling app.
View 7 Replies
ADVERTISEMENT
Jun 28, 2011
I have to handle concurrency control and I used SqlClient.SqlTransaction with IsolationLevel.Serializable level. In that transaction, I do 3 works:
1. Select the latest updated time from a record of a table
2. Compare the latest updated time with a stored time paramater
3. If the result form comparision is "same" I will update that record
But my problem is, when 2 transactions is run at almost the same time.
[Code]...
View 4 Replies
Mar 1, 2011
This probably shouldn't be too hard for someone to answer...even though I've spent 2 days trying to get it right. ::sigh::
I have a RichTextBox1 on my form. I need it to update every half second pulling HTML off of my webpage. I USED to have it update every half second with timers but everything keeps getting clogged and I realized I have to multi-thread.
My code so far is
Imports System.Threading
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
[Code]....
(This is an example of code from the bigger project) So I guess my question is how do I send out about 10 of these threads (Will the sleep suffice? Or will that just pause everything making it inefficient for multithreading at all and basically turn it into a timer), and what is the proper way to make the thread post the 'responseFromServer' to the RichTextBox1 in a safe way?
I can't get it to post at all because I know there's some invoke trick I can't figure out so I don't cross the threads like in ghost busters, and also if multiple threads are trying to post to it at once I'm going to need a protected way to do this.
View 3 Replies
May 13, 2011
Example:
Two files - TestClass.vb, myForm.vb
TestClass.vb looks as follows:
Imports System.Threading
Public Class TestClass
Private myClassThread As New Thread(AddressOf StartMyClassThread)
[code]....
The result:Application runs, no errors or exceptions.Displayed is the listbox and the Start button.I press the start button and a msgbox says "Not Invoked" as expected and upon clicking OK to that msgbox "Start Button Pressed" is added to the Output listbox control.Immediately following that the msgbox pops up again and says "Not Invoked". I was expecting "Invoked" as a separate thread is trying to use the Output listbox control.Of course this results in the Output.Items.Add being attempted which results in no visible result as the thread is not allowed to directly update the UI control.
View 1 Replies
Feb 2, 2010
I;m really new to VB.NET and desktop application development. Simplified this is what is happening in my application: [code]The last line will throw an Exception saying that img1 cannot be moved because it is in use. So my application is still using it, but how to make my application stop locking the file? There is nothing keeping a refrence to it (as far as I see)
View 2 Replies
Apr 28, 2009
I have a complex application running on IIS7 and Vista. It usually works ok but sometimes during longer processing threads/pages it seems to block(appear like there is no more wp's), but it blocks only on a single browser. Eg I have firefox open and go to a page which sleeps for 10 mins, then I hit other normal pages and these pages also seem to block. But in internet explorer the pages run really fast. This only happens for 2 minutes at then they are back to normal, the original page is still loading in the background but now those other pages are working ok.
Note, I have changed, network.http.max-connections, network.http.max-connections-per-server, network.http.max-persistent-connections-per-proxy, network.http.max-persistent-connections-per-server all to 100. Maybe I have missed some?
View 2 Replies
Apr 20, 2010
I am opening a bunch of excel files to read them line by line into sql at the moment - but ran into a small problem. When using something like this[code]...
if I then open the file manually, it will error the code. I put in some error protection, a try...catch block and if it errored, it will keep trying to open the file. If it opens the file, that means I closed it manually and the program will pick up from where it left off.
This isn't very successful, as other errors won't be trapped right, and the program will crash if I don't catch the errors (they cause an infinite error looping).
Is there a way to have the app/file open somehow, so if I open any other excel file, it won't open, or it will open but not error out in the program cause it's now physically open?
View 4 Replies
May 6, 2011
Put permanent Cap Locks on a Form?
View 18 Replies
Jan 30, 2012
Possible Duplicate: How can I programmatically determine if my workstation is locked? Checking for workstation lock/unlock change with c#
I would like to determine when a Windows (XP, or 7) machine is locked, and unlocked.I would like to create a timesheet activity logging app, and pre-filling times in, with lunch, breaks taken, etc, would be very useful.Is it possible to pick up an event that fires when the Windows Operating System is locked and unlocked ?
View 3 Replies
Apr 3, 2012
I'm developing a new program to add rows to a spreadsheet using VB.NET on a Windows 7 64 bit computer with Office 2010 installed. I have done this many times in the past with slightly different setups with no problems. This program locks on: xlWorkBook = xlApp.Workbooks.Open(FullFileName)After several minutes HRESULT=0x80131c08.ErrorCode=0x0 appears
I have to idea why it locks. The XLS does exist in the folder.
[Code]...
View 4 Replies
Mar 20, 2009
I develop an application through two multi project solutions.There is one solution for the data layer stuff and another one for the front end stuff.All the dlls are referenced in a startup project and have copy local = true. So the build output from the GUI solution and the dlls referenced from the data layer solution should be copied to this startup project's bin folder. This seemed to work without issue for some time, but after changing source control, after a rebuild of the data layer solution, I clean the GUI solution and get the following output: [code] I have researched this problem and it seems microsoft are aware of a problem, logged under MSB3061... but no solutions have been posted by MS. Several users have suggested stopping the indexing service from indexing bin and obj folders (I've done this). I've also ensured that none of the bin/obj folders are under source control. I downloaded FileMon from sysinternals and it says that devenv (GUI) has the file locks.
View 13 Replies
Dec 18, 2009
I develop windows applications in VB.NET using Visual Studio 2008. Recently I reloaded my pc and moved from XP to Windows 7 64 bit. Now when I am debugging, when I should get a runtime error, the executable instead locks up when it should bring up the code with the line that it crashed on like you'd expect in debug.
This doesn't happen all the time, only when I get a runtime error in a separate assembly that is not in the assembly I'm debugging. It used to work fine, but now it locks up. If I run the executable outside of Visual Studio (without debug) I at least get a runtime error like you'd hope for. I don't even get that when debugging.
View 1 Replies
Feb 26, 2012
What will I do to allow other forms to perform while crystal report view is running?
Heres the code:
Public Sub printCurrentHistory()
If dt.Columns.Count = 0 Then
With dt
.Columns.Add("update_time")
[code]....
View 2 Replies
Feb 9, 2012
I've have found answers here frequently in the past just from browsing. But now I'm completely dumbfounded.
I'm using Visual Basic 2010 Express, on Win7 32bit. My application talks to an Arduino via a virtual com port provided by a cheap Bluetooth to serial adapter. I use a text based protocol that is working fairly well. BUT one method in my code, taht seems functionally equivvalent to the other methods is locking up my whole window.
It does this whether I'm debugging or running the exe.Below are the offending method, and a simmilar one defined above it that works with no problems.
[Code]...
If I comment out the cal to write, everything works fine. Aside from me setting some state bools and playing with button titles in the first method, I can't see the difference as to why one works fine and the other hangs.
I really hope someone has some experience in the SerialPort object and VB that can shed some light on this.I've tried everything I can think of. I thought maybe it was the inline concatenation, so I dim'd a local and assigned the string to it, and passed that to Write. But I have another method that uses inline concatenation that doesn't do this.
View 1 Replies
Nov 23, 2010
I use VB 2008 express edition and i have this problem.I want to make a program that password locks any folder you want.(Using Icacls from command promt).My problem is that when i run the program
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If My.Computer.FileSystem.DirectoryExists(TextBox1.Text) Then
[Code].....
All this is done becouse i can't save the listbox contents in My.Mysettins.If anyone would be able to show me how to do it i would be helpfull.But please don't give me 50 lines of ununderstandable content.I want something that i will be able to understand becouse there no reason if i use it without knowing what it does.
View 1 Replies
Mar 29, 2010
I have a combo box (named cboGrade) that includes three different options (3rd, 4th, and 5th). I want to make the user be required to select an option from the list and then once the selection has been made, lock the control until either the user finishes the game or clicks the button named btnBeginAgain. How do I do this? I'm using Visual Basic 2005 Express Edition.
View 3 Replies
Apr 25, 2010
I have a windows form. On it is a text box and send email button.When you click the Send Email, it sends the contents of the text box via the System.Net.Mail
Private Sub SendEmail()
Try
Dim MyMailMessage As New MailMessage()
MyMailMessage.From = New MailAddress("myemail@email.com")
MyMailMessage.To.Add("myemail@email.com")
[Code]...
View 12 Replies
Sep 28, 2009
1)What are different types of Cursors?
2)What are diff types of locks? In some sites-
Four types of locks availbale in ADODB
1.Optimistic
2.pessimistic
3.batch optimistic
4.readonly
In some sites Forwardonly , lock,adLockUnspecified
What are exact locks,can somebody tell me?
3) What is Z order Precedence?
4) dim X,Y as integer
They ask me X is of which datatype in VB & in VB.net? I told integer in both Vb & VB.Net,they told me wrong?
View 5 Replies
Dec 21, 2011
I am making a program to test whether or not a host is online, assuming that host has blocked methods such as ping and netstat -t etc....
So I decided to try and connect to it, but the thing is every limitation I have set doesn't work. The program locks up for a few seconds (which I don't want in the first place) and I cannot terminate the client after say, 100ms of trying to connect.
[code]...
I have tried client.ReceiveTimeout but that didn't speed up the process, still takes the same amount of time for the program to respond.How should I go about testing if the server is up now? Or is there a way where the program wont lock for a few seconds as it does with the TCP method.
View 6 Replies
Apr 13, 2011
I am trying to run a backgroundworker to load data from my DAL (which is available in another class). I want to keep the UI available and not have the "locked up" feel while the object is loading.When I create a simple backgroundworker and Sleep the UI stays responsive and my controls can be updated after the sleep. As soon as I replace the sleep with a call to instantiate the object from my DAL, the UI locks up. Is there someway I can instantiate this object using the background worked and keep the UI responsive?
When the situation object is instantiated it could take several seconds for it to load completely, during this time is when the UI is locked up... It does eventually load just fine.
Private WithEvents backWork As New BackgroundWorker()
Dim sit As Situation
Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnLoad.Click
[code]....
View 1 Replies
Sep 23, 2010
I have a Windows Forms application created in VS2005 which runs fine on the user desktop but when running in Terminal Server session it frequently locks up when the remote desktop window is minimised and the user is working locally.There is plenty of RAM on the server so this is not an issue, the only solution so far has been to force the user session to log off on the Terminal Server and then reconnect.
View 14 Replies
Dec 23, 2010
I have a quite simple application that is having some random locks up. It's just a few text fields that the user fill it up, 3 sets of Radio buttons, one of them with flags to chose the language and click the PDF button. The application uses iTextsharp to load a PDf template, insert the text into it, depending on the language loads some extra text from a .xml file, and depending on the radio button removes the images from the PDF, closes the pdfstamper and uses [Code] to open the file with whatever PDF application the user have installed and closes itself.
Sounds simple, but after the application is installed in the machine (never in debugging mode) it randomly locks up the application. I tried re-publish the application commenting out the Start(filename) line and the thing stopped locking. And I double checked it, re-publish with the line again and it locked after just a few attempts. [Code]
View 1 Replies
Oct 27, 2010
I'm have a quite big application which have 2 serial ports and access 1 DB (running on Background workers). I'm experiencing some random locks while the application is running and I started looking for something that could cause it. One of the obvious possibilities would be if I had in the GUI thread some While_End that would never return.I have one While_End in my GUI thread but IMHO it does not look like it would lock, so I want your opinion: Does the code below looks like will lock?? If 'yes', Why ?
[code]...
Does anyone can imagine a scenario where this While_End would not return ?
View 1 Replies
Jul 7, 2009
I'm using Visual Studio 2008 and developing a VB.NET application. I'm having strange lockup problems with my program, but only when Internet explorer 8 is opened.
When I cover my form with another window and then uncover it, I find that it has locked up. My program has no references to IE and the only thing it even has to do with IE is using Process.Start with a web address.
My program works fine and exactly as it should, but only when IE is not opened.
Does anyone know why a program would lock up only while IE is running?
Edit: I've done some digging and I've found the offending thread in my program.
I don't know what starts this thread or what it does, but when I kill it, my program no longer freezes. The thread is one of the CreateApplicationContext threads, here is the last few items in the stack trace of that thread.
6 ntkrnlpa.exe+0x897bc
7 ntdll.dll!KiFastSystemCallRet
8 mscorwrks.dll!LogHelp_TerminateOnAssert+0x61
9 mscorwrks.dll!DllUnregisterServerInternal+0x10523
10 mscorwrks.dll!DllUnregisterServerInternal+0x10542
11 mscorwrks.dll!StrongNameErrorInfo+0x34387
12 mscorwrks.dll!StrongNameErrorInfo+0x34815
13 mscorwrks.dll!CreateApplicationContext+0xbc35
14 KERNEL32.dll!GetModuleHandleA+0xdf
Process explorer says my program is using no CPU nor throwing any exceptions while it is hung.
View 1 Replies
Apr 9, 2011
I have a problem with releasing locks on a thread. [Code] If Me.IsStarted Then 'checks if my service is started and ready of service requests 'code here to enqueue my job and objRxResult with the service so it can populate it with the result before Pulsing back 'the service has its own thread that it dequeues jobs off of and processes them on it own time 'during this key enqueue phase we block attempts to stop the service, thus the _objIsStarted lock [Code].
View 4 Replies
Jul 19, 2011
I have a do until loop. But whenever my program get's to it, it always locks the application so I can't click on anything until the loop is finished. How do I fix this? I want to be able to stop the loop with a stop button.
View 11 Replies
Sep 27, 2010
Is it possible to force the screensaver to appear whenever a computer becomes locked? Specifically on XP, 7 if possible.
View 2 Replies
Apr 9, 2010
The way I'm doing this is performing multiple reads on different tables to extract data. In this case I'm reading 2 different MS Access 2003 tables. I then dump the data into a "Row" variable that I have Publicly defined for each Class (each Access table is defined as a Class containing all the fields, Add, Change, Delete, and Select functions).For example, my first read extracts all the fields from the "tblClients" table and loads them into the form fields via the "clientROW" object. My second read extracts all the records from the "tblClientAddr" table associated with the selected Client and loads them into their form fields respectfully via the "addressROW" object.
View 3 Replies
Jan 16, 2009
I've got a problem with my latest project, I get concurrency error but I'm the only one working on the database.It's an sql server 2005 express database, and i'm making a remote connection. I have a related database or how do I say it, it's with relations. But the strange thing is that I can update the first table but the 2nd one not. Well here is my code, don't really know how to explain it better but I get an error when updating my orderinformation table but when only changing values in orders that table updates perfectly. [code]
View 3 Replies
Jan 28, 2011
My users are getting this error when trying to update the database:
"Concurrency violation: UpdateCommand affected 0 of the expected 1 records"
All the users are doing is clicking a button which updates a record.No two users are updating the same record or even within the same column. They could be updating within the same row but still not the same record.It seems to be happening when the program is open for a little while and they come back and try to update the database through the program. I have read a little bit about this error but none seem to lead to a clear solution.It seems like the database connection is timing out due to inactivity?Here is my update command:
vb.net
Private Sub btnComplete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnComplete.Click
Me.txtComplete.Text = Date.Today[code].....
View 13 Replies