PeterM
Member
Hi All,
I am writing a console application that reads in the details of a supplier price list from an SQL table, then reads the price list itself.
It then reads the products table and searches for products in the suppliers price list, if it gets a hit, it does some calulations on cost and retail pricing, writes any difference to a log file and updated the products table with the new prices for that product.
At least, thats what it should do!
I changed over from pervasive PSQL to MS SQL 2000 I believe (Licensed with SBS 2003 Premium).
The problem I am having is that I can read the price list file specs in from the SQL table, then it will read the price list file itself (XLS in this case) but when it comes to searching the products table in the same SQL database it gives me connection issues.
OK, here's the logic,
In a Globals module, I define the SQL connection string, then using the same string, I create 2 connections, one called PLConnection, the other called DBConnection.
In the Main module, I use the PL (Price List) connection in the standard way to read the price lists table to see which of the suppliers have price lists defined and what the columns in their particular file represent (they are all slightly different)
It then goes away and checks to see if the price list file exists on the server using the file name it just read from the Price Lists table.
If the price list is found, it then opens and reads it by whatever method is suitable to that particular file type (again specified in the price lists table) in this case XLS.
It then does a case select and chooses the right method of processing the price list dependant on file type, so it reads the price list in from the spreadsheet in this case.
It then searches for each product in the price list in the products table and if it finds a match, it processes the prices. There are tens of thousands of products in these supplier price lists, not all of which are in the products table, so it has to search each one until it finds a match.
This is the point it is getting stuck on, where, and having already opened one of the two defined connections to read the price list table (there may be multiple price lists defined so it has to read one, process it and then read another one, so the connection is left open.
In opening the second definded connection, when I do a DBConnection.open() it errors telling me the connection is already open, yet when I comment out that line, the ExecuteReader statement tells me there is no open connection!
I guess this is something to do with connection pooling, but I have searched and searched on the web and cant find anything different to what Im doing now.
Any help greatly appreciated!
I am writing a console application that reads in the details of a supplier price list from an SQL table, then reads the price list itself.
It then reads the products table and searches for products in the suppliers price list, if it gets a hit, it does some calulations on cost and retail pricing, writes any difference to a log file and updated the products table with the new prices for that product.
At least, thats what it should do!
I changed over from pervasive PSQL to MS SQL 2000 I believe (Licensed with SBS 2003 Premium).
The problem I am having is that I can read the price list file specs in from the SQL table, then it will read the price list file itself (XLS in this case) but when it comes to searching the products table in the same SQL database it gives me connection issues.
OK, here's the logic,
In a Globals module, I define the SQL connection string, then using the same string, I create 2 connections, one called PLConnection, the other called DBConnection.
In the Main module, I use the PL (Price List) connection in the standard way to read the price lists table to see which of the suppliers have price lists defined and what the columns in their particular file represent (they are all slightly different)
It then goes away and checks to see if the price list file exists on the server using the file name it just read from the Price Lists table.
If the price list is found, it then opens and reads it by whatever method is suitable to that particular file type (again specified in the price lists table) in this case XLS.
It then does a case select and chooses the right method of processing the price list dependant on file type, so it reads the price list in from the spreadsheet in this case.
It then searches for each product in the price list in the products table and if it finds a match, it processes the prices. There are tens of thousands of products in these supplier price lists, not all of which are in the products table, so it has to search each one until it finds a match.
This is the point it is getting stuck on, where, and having already opened one of the two defined connections to read the price list table (there may be multiple price lists defined so it has to read one, process it and then read another one, so the connection is left open.
In opening the second definded connection, when I do a DBConnection.open() it errors telling me the connection is already open, yet when I comment out that line, the ExecuteReader statement tells me there is no open connection!
I guess this is something to do with connection pooling, but I have searched and searched on the web and cant find anything different to what Im doing now.
Any help greatly appreciated!