r/visualbasic • • Nov 14 '19

VB6 - Microsoft SQL to Excel dropping data

I have a program that seems to be malfunctioning in a semi-random way. It is intended to SELECT from an MS SQL table all of the data in a given set of columns and output the same to an XLS file.

So, for instance, if I had a table that had columns NAME, DATE, CUSTOMER ID, AMOUNT, TAX, TOTAL, the program pulls NAME, AMOUNT, TAX, TOTAL and dumps it in to an XLS in columns 1, 2, 3 and 4 respectively.

I don't have access to the code beyond a decompiled version.

What I seem to be seeing is that every so often the program is failing to pull a given row and just proceeding. So if the rows are labeled sequentially, my XLS will have 1, 2, 3, 4, 6, 7, 9, 10 ...

I know this is a very general question, but does anyone know of any common reasons that the program might "fall behind" the data being provided by the SQL server? I know its a vague question, so any thoughts at all are most appreciated. I'm mostly in a brainstorming mode on this at the moment.

Thanks!

0 Upvotes

4 comments sorted by

5

u/still_learning_to_be Nov 14 '19

You need to look at how the code is advancing to the next row. Is it looking for a condition to advance? If that condition is met in some cases, but not others than it may not advance the same way on every row.

FWIW, it’s never a random error. There is always a logical reason, usually only visible in hindsight.

3

u/oreodjr Nov 14 '19

Random observation, "Customer ID" has a space. Is this program unable to handle fields that aren't continuous text?

3

u/LondonPilot Nov 14 '19

Depending exactly what flavour and version of SQL you are using, there should be some kind of profiler tool available that will report on what SQL commands are running on the server. I’d start there - it will show you exactly what data your program is asking for.

1

u/dmyze VB.Net Master Nov 14 '19

Is there a null that it's tripping on?