G
Guest
Hi All,
I have a small asp.net app developed in C#, where I am using COM components
and Activepdf toolkit to create pdf files for given documentID's. I am using
DataReader to get the docID's from sybase database.
My problem is, the application when opened or accessed first time after 1
day or 1/2 hour the count, DataReader has is different and if I run the
application immediatly with same criteria, it runs perfect. For e.g. I have
27 docID's returning from database and the first time app runs gives me 0 or
3 or 26, If I run immedialty again it gives me the correct number 27. I tried
all the possible ways to solve this or find where exactly the problem is, But
couldn't figure it out. If anybody has any idea or clues, please help me
solving this.
Here is my code:
try
{
myConnection = new OleDbConnection(connString);
myConnection.Open();
myCommand = new OleDbCommand(inputQuery, myConnection);
int docid = 0;
dr = myCommand.ExecuteReader();
oPDF= new ColdActivePDF.cDisplayColdActivePDFClass();
int ctr = 0;
if (dr.HasRows)
{
while (dr.Read())
{
// get the docid
docid = dr.GetInt32(0);
// get PDF for this docid
byte[] vntStream;
System.Object strErr = new System.Object();
vntStream = (byte[])oPDF.ReadPDFBinFile("ae_dl" + tableID, docid.ToString()
, connString, ref strErr, "Single");
writeToPDFFile(DirPath + docid + ".pdf", ref vntStream);
ctr += 1;
}
}
else
{
lblMessage.Text = "No rows returned.";
}
Response.Write(ctr);
"writeToPDFFile()" procedure is working perfect. I checked the count of rows
DataReader has with ctr variable setup, the count itself is wrong only the
first time.
we have another application with same functionality which is running fine
and just did a copy paste of that code and this application has few
enhancements, that I commented to make this work first.
Thanks in advance!
I have a small asp.net app developed in C#, where I am using COM components
and Activepdf toolkit to create pdf files for given documentID's. I am using
DataReader to get the docID's from sybase database.
My problem is, the application when opened or accessed first time after 1
day or 1/2 hour the count, DataReader has is different and if I run the
application immediatly with same criteria, it runs perfect. For e.g. I have
27 docID's returning from database and the first time app runs gives me 0 or
3 or 26, If I run immedialty again it gives me the correct number 27. I tried
all the possible ways to solve this or find where exactly the problem is, But
couldn't figure it out. If anybody has any idea or clues, please help me
solving this.
Here is my code:
try
{
myConnection = new OleDbConnection(connString);
myConnection.Open();
myCommand = new OleDbCommand(inputQuery, myConnection);
int docid = 0;
dr = myCommand.ExecuteReader();
oPDF= new ColdActivePDF.cDisplayColdActivePDFClass();
int ctr = 0;
if (dr.HasRows)
{
while (dr.Read())
{
// get the docid
docid = dr.GetInt32(0);
// get PDF for this docid
byte[] vntStream;
System.Object strErr = new System.Object();
vntStream = (byte[])oPDF.ReadPDFBinFile("ae_dl" + tableID, docid.ToString()
, connString, ref strErr, "Single");
writeToPDFFile(DirPath + docid + ".pdf", ref vntStream);
ctr += 1;
}
}
else
{
lblMessage.Text = "No rows returned.";
}
Response.Write(ctr);
"writeToPDFFile()" procedure is working perfect. I checked the count of rows
DataReader has with ctr variable setup, the count itself is wrong only the
first time.
we have another application with same functionality which is running fine
and just did a copy paste of that code and this application has few
enhancements, that I commented to make this work first.
Thanks in advance!