Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Record gets inserted...yes and no...

Status
Not open for further replies.

sqlnerd

Programmer
Jan 21, 2003
24
IN
Hi,

I encounter this peculiar problem. I have the database connection string as an application variable (declared in global.asa). When i open a connection object with this connection string in an asp page, it inserts records into the table as required. But this happens only 3 out of 4 times. means... it is not inserting sometimes. The connection object does not get created. If i refresh the page with F5 it inserts. What could be wrong? I have finetuned IIS a bit by increasing the CPU usage % and reduced the no of hits per day. Still this does not help.

Can anybody throw light on this.

Thanx in advance.

SQLNerd
 
do u close the connection object in the global.asa file?

why do u wan to use the connection in global.asa?

Known is handfull, Unknown is worldfull
 
It may be one of two things. 1) try setting a no-cache for all the pages where the connection is heald. 2) make sure all connections are closed after opened.

I've personaly never liked using application or session variables for holding bays for connection strings. Just seems to be prone to problems. My suggestion is to create a include file with this information and place it in all the pages for use. It is much more stable to do things this way.

____________________________________________________
The most important part of your thread is the subject line.
Make it clear and about the topic so we can find it later for reference. Please!! faq333-2924

onpnt2.gif
 
vbkris, I think they are jsut using the app. variable for the string and open when needed. I hope anyhow!

____________________________________________________
The most important part of your thread is the subject line.
Make it clear and about the topic so we can find it later for reference. Please!! faq333-2924

onpnt2.gif
 
How are you doing the insert?
StoredProc,InsertStatement,Recordset?
Are you using a Connection,Command or a recordset?
Are you destroying your connection/command/recordset after you use them?
What do you see in SQLProfiler? Do you see the connection attempt?

Looking for more info

Rob
 
yup what onpnt said is correct it makes sense only to include a connection file...

Known is handfull, Unknown is worldfull
 
Hi,

Thanks for all your quick response. I have declared only the connection string as an application variable and not the connection itself. I am inserting through the connection.execute statement. I am opening the connection before the execution (naturally) and close the connection immediately after the execution statement. One more thing... I am using MS Access as database.

Now, I have found another interesting thing... when I save the asp page and execute it, IIS executes only the previous version of this page. I think restarting IIS may not be a possible solution, because other asp pages where I handle connection object work fine even after i modify and run them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top