why is it only my first row of my sql table is being read :(
so I am trying to make this feature where the program checks the sql table every minute and if the due date is 5 minutes before the current date a notification is popped up to the users desktop screen. I am using Tulpep for the notifications, and the windows task scheduler to run the program in the background. now what happens is that the first row is read and thats not all the rows of my sql table. here is what the event viewer shows me when it does the task
Log Name: Application
Source: TaskReminderService
Date: 28/07/2024 21:50:35
Event ID: 0
Task Category: None
Level: Information
Keywords: Classic
User: N/A
Computer: Zeeshan
Description:
Sending notification for task: Watch the new movie , Description: new action film 😄
Event Xml:
<Event xmlns="xxxxx">
<System>
<Provider Name="TaskReminderService" />
<EventID Qualifiers="0">0</EventID>
<Version>0</Version>
<Level>4</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2024-07-28T20:50:35.1964862Z" />
<EventRecordID>62052</EventRecordID>
<Correlation />
<Execution ProcessID="xxxxx" ThreadID="x" />
<Channel>Application</Channel>
<Computer>Zeeshan</Computer>
<Security />
</System>
<EventData>
<Data>Sending notification for task: Watch the new movie , Description: new action film :D</Data>
</EventData>
</Event>
as you can see it only reads my first line of my sql table and stops and when the task runs again it still only reads the first line.
9 Replies
here is my code how do I get it to check all the tasks maybe something is wrong with my sql search query???
can you narrow this code down to the part that makes the sql query that isn't working?
this si the code for checking the sql table
so a couple things i would check first
1. run the query in your database management tool and make sure it returns the rows you're expecting
2. step through this code in a debugger to make sure it's not doing something unexpected
ok will do thx
it returns the expected results so thats good
yep, that means the issue is definitely somewhere in the C# code
i'd set a breakpoint right before the part that you think is going wrong and step through to watch exactly what it's doing
then you can figure out exactly where the issue is
I am not too sure which part is going wrong thougj any suggestions of where to start?
well, your assumption is that something is going wrong between making the query and reading the results/sending the notifications
so if it were me i'd put a breakpoint right before sending the query and stepping through from there
ok will try that thanks