473,385 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Strange problem (asp.net application)

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!
Nov 17 '05 #1
1 1349
I have found solution for this problem of database not returning correct
number of rows first time the application is accessed after 1 day or 1/2 hour
or 1hr.
I have given commandobject.commandtimeout = 0 after I instantiated the
command object.
Microsoft does not actually recommend giving 0 i.e. infinite time limit for
the command object, So I have tried 300 sec or more and it solved my problem.

"Hash" wrote:
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!

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Trapulo | last post by:
I've two copy af the same asp.net application. The application enter on sql server, working with two separate databases (on the same sql server instance, of course). The connection is made with...
2
by: | last post by:
Let me explain step wise. 1.. I have a site running on port 5555 2.. If contains web.config file with contains <Forms> authentication. 3.. The site contains a sub-folder named "MembersArea"...
2
by: Kris Vanherck | last post by:
yesterday i started getting this strange error when i try to run my asp.net project: Compiler Error Message: CS0006: Metadata file 'c:\winnt\microsoft.net\framework\v1.1.4322\temporary asp.net...
2
by: Sammy | last post by:
Everyone, I have this very strange problem and we spent weeks to figure out what's going on. Let me outline the configuration of our system: 1. .NET Framework v. 1.0.3705 2. SQL 2000 SP 3...
0
by: Jerry Morton | last post by:
Hi, This is a strange one. I have the following ASP.NET application: /default.aspx /login.aspx /web.config /bin/myapp.dll /secure/aCommonSecurePage.aspx
0
by: Chris | last post by:
I'm moving an app to my server and got this strange error. The previous developer created a web service and has two C++ COM+ objects in the project. I'm getting: Access to the path...
17
by: jensen bredal | last post by:
Hello, i'm struggling with a somehow badly understood session scenario. I provide acces to my pages based on form authentication using Session cookies. Som of my pages are supposed to be...
6
by: Gary | last post by:
I have an application that has been working just fine for a couple of years. It queries a SQL database and returns some formatted data back to the client. I have a new client, who has a larger...
5
by: Nathan Sokalski | last post by:
When I view my index.aspx page any time after the first time, I recieve the following error: System.Web.TraceContext.AddNewControl(String id, String parentId, String type, Int32 viewStateSize)...
1
by: xudeutsch | last post by:
Maybe no one is interested but i need the solution. This time followed the steps made by Microsoft:install IIS, .net and Visual Studi components that are required for Visual Studio to be able t...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.