How often do you look at some code that you have written, and wonder why it doesnt work? I mean, REALLY wonder why it doesnt work? You look at it, and realise that you know it's something you've done, but just cannot for the life of you work out why it isnt working.
I have a new solution to...
My guess is that the MSComm in VB6 is not closing correctly - hence denying the .NET access to COM1.
1. Post your .NET code here, so we can check it.
2. Try NOT running the VB6 version at all, to see if the .NET version works.
As jmilhinney said, you can strip the time from the values in the database, and then just send one parameter.
CAST (FLOOR (CAST (LogDate AS FLOAT)) AS DATETIME) = @LogDate
CONVERT(nvarchar(10), MyersTable.PlanWeek, 103)
CONVERT(DATETIME, RawDataTable.PlanWeek, 103)
are not the same - this is why it was failing. I believe that the ORDER BY statement needs to EXACTLY match one of the fields in your SELECT statement.
SELECT CONVERT(nvarchar(10), MyersTable.PlanWeek, 103) as [PlanWeek], IntIngredientTable.IngredientName, SUM(IntIngredientTable.Quantity) as [Quantity (KG)]
INNER JOIN MyersTable on IntIngredientTable.MyersID = MyersTable.MyersID
GROUP BY IngredientName, PlanWeek
Even though I knew what I was looking for, it still took me minutes to find it in that mess - PLEASE use CODE tags in the future to make it legible!
I suggest you stop, and look at any of the links on this forum relating to Data Applications and Worked examples - if you can, find posts by user...
I doubt you will manage to find a book that will cover this. My suggestion would be to search for manufacturer-specific .NET to PLC examples on the internet.
There are lots of tricks that I have found as I have written HMI to PLC software - and unfortunately, a lot of it comes down to "write...
Turned out it wasnt the COM port thread, it was a UDP listening thread - which I had written with a blocking Receive method rather than asynchronous BeginReceive method.
Am going to rewrite it using code from this jmcilhinney reply
I've been trying to eradicate all first chance exceptions, to ensure all errors are properly accounted for. However, when I close my program, I still have two First Chance exceptions :-
As far as I knew, all my many threads are closed properly, but obviously not. I have tried to find the...
Hope I have understood your problem correctly :) You werent a million miles away with your first attempt. However, points to note :-
1. Try and avoid using Subqueries. As far as I understand, subqueries will be run once for every record in your transaction_inventory table (using your query...
Alternatively, if a program crashed without necessarily closing the COM port, the port *may* still believe it is in use. Any further access to the port will be denied.
Always handle any program errors VERY carefully when dealing with COM ports - lots of Try..Catch..End Try required !