Author |
Topic |
acex10
Starting Member
13 Posts |
Posted - 2005-01-03 : 03:47:00
|
Greetings!I have this line of code: strSql = "Update PageLoad Set Impressions = Impressions + 1 where ID = 0" I have an access database...coloumn is called 'Impressions' of datatype numbers. When I execute the sql above it give me the value of 2 where the default Impression value is 0? Can anyone help me to solve...?Thanx |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2005-01-03 : 04:07:11
|
>> default Impression value is 0But what was the value before you executed this - 1?==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
acex10
Starting Member
13 Posts |
Posted - 2005-01-03 : 04:09:44
|
Default value is 0.but why it increment 2 and not 1? |
 |
|
acex10
Starting Member
13 Posts |
Posted - 2005-01-03 : 04:11:25
|
Default value is 0.but why it increment 2 and not 1? |
 |
|
acex10
Starting Member
13 Posts |
Posted - 2005-01-03 : 04:13:09
|
Default value is 0.but why it increment 2 and not 1? |
 |
|
acex10
Starting Member
13 Posts |
Posted - 2005-01-03 : 04:14:46
|
Default value is 0.but why it increment 2 and not 1? |
 |
|
acex10
Starting Member
13 Posts |
Posted - 2005-01-03 : 04:16:17
|
Default value is 0.but why it increment 2 and not 1? |
 |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2005-01-03 : 04:18:10
|
That may have been the default but had it been changed before this code was run? Was it inserted with a value and not allowed to default? Was the code run twice?==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
acex10
Starting Member
13 Posts |
Posted - 2005-01-03 : 04:25:13
|
No. The code was run once only. This is the entire code. Wat is the main cause of inserting the record twice instead of 1?<%@LANGUAGE="VBSCRIPT" %><html><head><title>Links</title></head><body><%Sub PageLoad()Dim strSql strSql = "Update PageLoad Set Impressions = Impressions + 1 where ID = 0" Dim DBConnectionDim rsSet DBConnection = Server.CreateObject("ADODB.Connection")DBConnection.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\Clickthru\PageLoad.mdb")Set rs=Server.CreateObject("ADODB.Recordset")rs.open strSql, DBConnectionDBConnection.Execute(strSql)End SubCall PageLoad%>Please help.Thank in advanced! |
 |
|
acex10
Starting Member
13 Posts |
Posted - 2005-01-03 : 04:26:42
|
No. The code was run once only. This is the entire code. Wat is the main cause of inserting the record twice instead of 1?<%@LANGUAGE="VBSCRIPT" %><html><head><title>Links</title></head><body><%Sub PageLoad()Dim strSql strSql = "Update PageLoad Set Impressions = Impressions + 1 where ID = 0" Dim DBConnectionDim rsSet DBConnection = Server.CreateObject("ADODB.Connection")DBConnection.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\Clickthru\PageLoad.mdb")Set rs=Server.CreateObject("ADODB.Recordset")rs.open strSql, DBConnectionDBConnection.Execute(strSql)End SubCall PageLoad%>Please help.Thank in advanced! |
 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2005-01-03 : 06:49:57
|
Seeing as how you are having trouble posting your responses here just once, I have a feeling you may have also accidentally run your script more than once! - Jeff |
 |
|
acex10
Starting Member
13 Posts |
Posted - 2005-01-03 : 20:58:15
|
I'm sorry. I do not know what's wrong with my connection.But how come the entire code was run once but the increment in the database is 2?Please help me with it. Thank in advance! |
 |
|
Stoad
Freaky Yak Linguist
1983 Posts |
Posted - 2005-01-04 : 04:15:42
|
Sometimes, when line condition in my local area is very bad, I've got my posts double-posted (of course, I click the submit button only one time). The whole thing looks as if my post is sent in some unknown direction, then it is echoed back and "posted" again (with time gap ~1 minute). And I got my post count incremented by 2 (exactly your case).In short, first of all test your ASP code locally (browser & web server on the same machine).Or maybe your mouse got rotten. |
 |
|
acex10
Starting Member
13 Posts |
Posted - 2005-01-04 : 04:37:34
|
Thanks . The problem is solved. |
 |
|
|