Help Needed
-
I am doing a 200 marks project. However I have encountered some problems. (1) I am using LINQ command to delete an entry from database in my application. After the code block is executed that particular entry is deleted from database however the binding navigator control or my application doesnot acknolodge the change. I tried to acknolodge the change by refreshing and/or updating the form and/or control. (2) I also want to how to count total number of entries present in the database and the index of the current selected entry dynamically. After deleting or adding an entry the change is not acknolodged. (3) I am doing a hardware project where I use a service which when activated will get my COM port(serial port) in passive open state. I am achieving this by creating a infinite for loop. However by doing this whenever my I start the service I am not able to use rest of application. I plan to overcome this problem by using threading. I plan to use one thread for the service but don't know if I should use thread for other elements. I only have one service in my application. I have no idea with any aspect of threading. Please guide me in this issue. I have a doubt if the signal arrives when the thread is not in focus then would the signal be lost. Please guide me for these issue.
-
I am doing a 200 marks project. However I have encountered some problems. (1) I am using LINQ command to delete an entry from database in my application. After the code block is executed that particular entry is deleted from database however the binding navigator control or my application doesnot acknolodge the change. I tried to acknolodge the change by refreshing and/or updating the form and/or control. (2) I also want to how to count total number of entries present in the database and the index of the current selected entry dynamically. After deleting or adding an entry the change is not acknolodged. (3) I am doing a hardware project where I use a service which when activated will get my COM port(serial port) in passive open state. I am achieving this by creating a infinite for loop. However by doing this whenever my I start the service I am not able to use rest of application. I plan to overcome this problem by using threading. I plan to use one thread for the service but don't know if I should use thread for other elements. I only have one service in my application. I have no idea with any aspect of threading. Please guide me in this issue. I have a doubt if the signal arrives when the thread is not in focus then would the signal be lost. Please guide me for these issue.
First, without seeing any code, it's very difficult to say what you did wrong. But, I'll take some guesses.
Ishaan Karnik wrote:
(1) I am using LINQ command to delete an entry from database in my application. After the code block is executed that particular entry is deleted from database however the binding navigator control or my application doesnot acknolodge the change. I tried to acknolodge the change by refreshing and/or updating the form and/or control.
This is probably because you bypassed the dataset/datatable the controls are bound to and made the changes directly to the database. You'd have to refresh the dataset/datatable, or whatever collection you used so it retrieves the new data from the database.
Ishaan Karnik wrote:
(2) I also want to how to count total number of entries present in the database and the index of the current selected entry dynamically. After deleting or adding an entry the change is not acknolodged.
Again, you bypassed the local collection of records when you made the update. You can get the current number of records from the DataSet/DataTable or collection that you used to hold the data. There are Count and Length properties you could use to determine this. The currently selected record would be available from the BindingNavigator you have setup.
Ishaan Karnik wrote:
(3) I am doing a hardware project where I use a service which when activated will get my COM port(serial port) in passive open state. I am achieving this by creating a infinite for loop. However by doing this whenever my I start the service I am not able to use rest of application.
Your description doesn't make sense. Are you saying that you're running your application as a service?? This is a REALLY bad idea. If not, then did you launch your actual work under a seperate thread in the services OnStart event? (This is where some code small code snippets would help a lot!)
Ishaan Karnik wrote:
I plan to use one thread for the service but don't know if I should use thread for other elements.
What other elements?? What is this service supposed to do??
Ishaan Karnik wrote:
I have a doubt if the signal arrives when the thread is not in focus then would the signal be lost.
COM port communuca
-
First, without seeing any code, it's very difficult to say what you did wrong. But, I'll take some guesses.
Ishaan Karnik wrote:
(1) I am using LINQ command to delete an entry from database in my application. After the code block is executed that particular entry is deleted from database however the binding navigator control or my application doesnot acknolodge the change. I tried to acknolodge the change by refreshing and/or updating the form and/or control.
This is probably because you bypassed the dataset/datatable the controls are bound to and made the changes directly to the database. You'd have to refresh the dataset/datatable, or whatever collection you used so it retrieves the new data from the database.
Ishaan Karnik wrote:
(2) I also want to how to count total number of entries present in the database and the index of the current selected entry dynamically. After deleting or adding an entry the change is not acknolodged.
Again, you bypassed the local collection of records when you made the update. You can get the current number of records from the DataSet/DataTable or collection that you used to hold the data. There are Count and Length properties you could use to determine this. The currently selected record would be available from the BindingNavigator you have setup.
Ishaan Karnik wrote:
(3) I am doing a hardware project where I use a service which when activated will get my COM port(serial port) in passive open state. I am achieving this by creating a infinite for loop. However by doing this whenever my I start the service I am not able to use rest of application.
Your description doesn't make sense. Are you saying that you're running your application as a service?? This is a REALLY bad idea. If not, then did you launch your actual work under a seperate thread in the services OnStart event? (This is where some code small code snippets would help a lot!)
Ishaan Karnik wrote:
I plan to use one thread for the service but don't know if I should use thread for other elements.
What other elements?? What is this service supposed to do??
Ishaan Karnik wrote:
I have a doubt if the signal arrives when the thread is not in focus then would the signal be lost.
COM port communuca
You, sir, get a 5 just for attempting to sort that out. :thumbsup:
Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy Individuality is fine, as long as we do it together - F. Burns Help humanity, join the CodeProject grid computing team here
-
You, sir, get a 5 just for attempting to sort that out. :thumbsup:
Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy Individuality is fine, as long as we do it together - F. Burns Help humanity, join the CodeProject grid computing team here
I try. Though, sometimes, it's just hopeless. :sigh:
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008