IP Cam Talk

Welcome to the new IPCT! If you are having an issue logging in, please clear your cookies / cache.

OpenALPR Tool - Save and Query CSV Exports

Nyghthawk

Getting the hang of it

Go into the "LPR_Downloader.cs" code and place a breakpoint as indicated in the snapshot below. Then run the code (pressing the Green "Start" arrow at the top toolbar). Then try to manually upload a CSV, and when the code stops at the breakpoint, keep slowly pressing the F10 key to step through the code, and follow what it does.

View attachment 45856
I wonder if the database connection has something do so with it because it shows .\\SQLEXPRESS and not .\SQLEXPRESS
 

DLONG2

Getting comfortable
My connection string is identical:
"Data Source=.\\SQLEXPRESS;Initial Catalog=LPR;Persist Security Info=True;Integrated Security=true"

Wondering about the ServerVersion exception, though . . .
 

Gymratz

Getting the hang of it
I have an idea... But first tell me, when you start the program does it have your SQL Connection already in the settings (from the last time) or is it cleared out and you're having to re-enter?
 

Nyghthawk

Getting the hang of it
I have an idea... But first tell me, when you start the program does it have your SQL Connection already in the settings (from the last time) or is it cleared out and you're having to re-enter?
settings are saved everytime i reopen.

It reads from LPR_Downloader.exe.config file that is in the same folder as LPR_Downloader.exe
 

Gymratz

Getting the hang of it
Ok - I wanted to make sure. It should do that!
I'm not entirely sure what that error means; however, it seems to get by another section where it is writing into and reading from the import history. I'm going to fix up some inconsistencies, make sure it still works for me, and then commit it up to git.
 

Gymratz

Getting the hang of it
I had some inconsistencies in variables and how I called them. This impacted two areas in this program. I've updated both to follow what the rest of the code did. I think in an ideal world you'd just pull this down from git and see the changes. But in case you are as new to git as I am.... Here are the code-blocks that have changes.

upload_2019-8-11_15-57-26.png

upload_2019-8-11_15-58-14.png
 

Nyghthawk

Getting the hang of it
I had some inconsistencies in variables and how I called them. This impacted two areas in this program. I've updated both to follow what the rest of the code did. I think in an ideal world you'd just pull this down from git and see the changes. But in case you are as new to git as I am.... Here are the code-blocks that have changes.

View attachment 45860

View attachment 45861
Downloaded new from git...

no errors on compile

Auto Download does adds 0/0
Manually upload file adds 0/0 (no time stamp either).



Did the same "f10" step through, was able to not get that error at the beginning.


Also previously you asked if it shows the DATA base on the time that I start it or does it wait till a second time,

So I started the AutoDL on lets say 4:15, the area was blank, and then when it downloaded at 4:16, the data base table was updated, but again with 0/0
 

Gymratz

Getting the hang of it
Here's where the Manual Upload gets called, line 564. I'm thinking there has to be an error in there somewhere. Can you put a break-point on that "UploadStream" and then step through it?
upload_2019-8-11_16-23-21.png
 

Nyghthawk

Getting the hang of it
Here's where the Manual Upload gets called, line 564. I'm thinking there has to be an error in there somewhere. Can you put a break-point on that "UploadStream" and then step through it?
View attachment 45862
It stepped through no problem.....

however i thinkthe problem is still with adding to DATABASE, as AUTO download, letting it run, does NOT add anything to the database.

So I used your idea of "save to history" and put a breakpoint there....



Looks like no data is being parsed to the DB
 
Last edited:

Gymratz

Getting the hang of it
I believe you're right, but narrowing down why will take stepping through the code for more than just errors, but to see where things are going wrong or getting skipped.

I would definitely expect to see a decent size number here (however many entries are in the manual CSV you saved and are trying to upload). Also the streamCSV.Length should basically be the file size.
upload_2019-8-11_16-33-31.png


I would expect the highlighted portion to never be hit since you don't have anything in the DB yet.
upload_2019-8-11_16-34-4.png


I would expect the cross to not be hit, and the highlighted to be hit multiple times.
upload_2019-8-11_16-35-29.png


This entire section should be called once for each row in the CSV file and the most-inner (AddWithValue) once for each column, again with each row.
upload_2019-8-11_16-37-15.png

Somewhere there must be an error. Though I did just realize that earlier F10 was mentioned and I think you want f8 for "Step Into" which will go line by line. Stepping into every loop, etc., until it hits an error. When it hits the error it will jump all the way out to the catch block most likely - so catching it as it does that to know where would be important.
 

Attachments

Nyghthawk

Getting the hang of it
Somewhere there must be an error. Though I did just realize that earlier F10 was mentioned and I think you want f8 for "Step Into" which will go line by line. Stepping into every loop, etc., until it hits an error. When it hits the error it will jump all the way out to the catch block most likely - so catching it as it does that to know where would be important.
It was F11 to "step into" (I changed the length to 100, just in case the CSV files were small, even though your length was 500....

So i encountered "RED" here, but I Cannot see any exceptions or errors, and as I go through, there are no exceptions, except for anything to do with the database fields, and its just red



 

Gymratz

Getting the hang of it
I'm thinking it will take a very long time to step through it all with the CSV file being 171kb.
A quick a dirty way to confirm if something triggering the try/catch would be to fill out the catch.
Make this
upload_2019-8-11_16-52-30.png

Look more like this
upload_2019-8-11_16-52-54.png

Also put a break point when you catch/show the exception. If you hit the break point (or see the message box) we'll have confirmation of an error and if there is one, hopefully enough information to proceed.
 

Nyghthawk

Getting the hang of it
now I get this

unrelated to other stuff



but when I run it in "auto download" mode, it just goes minute after minute of "downloading" but never adding anything to the db either....

I apologize for this, it seems like I hit a wall so early.
 
Last edited:

Gymratz

Getting the hang of it
No, this is perfect actually. This is likely exactly where it is all failing. Can you look through your CSV file for the value "32789" and find what Column it is in?
Good chance the DB has the field type as something too small to accept that - maybe a tinyint or smallint that needs to be upgraded.
 

Nyghthawk

Getting the hang of it
No, this is perfect actually. This is likely exactly where it is all failing. Can you look through your CSV file for the value "32789" and find what Column it is in?
Good chance the DB has the field type as something too small to accept that - maybe a tinyint or smallint that needs to be upgraded.
company field
 

Gymratz

Getting the hang of it
I have that in the DB as a "smallint" which only goes to 32,767 -- your value is larger.
"Edit" the LPR_PlateHits table, change "company" to just type "int" -- Save the table and then go try the import again.
 

Gymratz

Getting the hang of it
Looks like some error-checking may be needed around the line before it telling it to Open the DB connection since the status is "Connecting..." -- Never seen that before though - even on remote connections... I'm not sure of this one and can't look into it any more tonight.
 

Nyghthawk

Getting the hang of it
Looks like some error-checking may be needed around the line before it telling it to Open the DB connection since the status is "Connecting..." -- Never seen that before though - even on remote connections... I'm not sure of this one and can't look into it any more tonight.
recompiled...i guess i just go slower with the import...

as it appears to be importing my manually imported files now



just doesnt seem to be complete with it, as I picked a date that everything should be imported and it is marked as skipped.

It loads the manual CSVs but crashes, just have to reload it, and it loaded them in the DB apparently (havent tried viewer) I feel with the auto download at 1 minute, itll be fine.





Was able to get viewer to read the DB, as much as it could.



Not sure if I need more data, but am not getting much information on the "viewer" program, but thanks so much for helping me get through this database issue.

getting blank boxes plus results due to "web server" not being setup






Enabled Webserver in settings, also adjusted one of your code lines....

as the date(-1) was erroring out on startup, not sure why....

and now with webserver enabled and the date changed I bring to you.......






THANKS FOR STICKING WITH ME!!
 
Last edited:

DLONG2

Getting comfortable
It's really gratifying to see that you have the apps up and running, Nyght. Your persistence has helped others who will follow, too. Gym has some really slick features in there. He figured out how to effect the automatic downloads of the CSV files, and is a whiz at SQL coding.
 
Top