473,769 Members | 7,646 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

why does this simple script doesn't work

Hi

I am trying to update a date field in my table but some how this simple code
does not work, I know the select work because if I write the fields, it will
show the data from the table but why the update does not work?
<%

Set ConnGallery = Server.CreateOb ject("ADODB.Con nection")
ConnGallery.Ope n ConnectionStrin g
Set cmdTemp = Server.CreateOb ject("ADODB.Com mand")

Set CmdUpdateAd = Server.CreateOb ject("ADODB.Rec ordset")
cmdTemp.Command Text = "SELECT Ads.* FROM Ads WHERE Advertiser=0 "
cmdTemp.Command Type = 1
Set cmdTemp.ActiveC onnection = ConnGallery
CmdUpdateAd.Ope n cmdTemp, , 1, 3

CmdUpdateAd.Fie lds("Ad_Expires ") = " "
CmdUpdateAd.Upd ate
CmdUpdateAd.Clo se

response.Write ("hej")

%>
Jul 19 '05 #1
3 3742
What "does not work" about it? Are you getting an error? Are there any
records where advertiser=0? Why are you creating a recordset for an update?
Is Ad_Expires a text column?
Do this

sSQL = "UPDATE [Ads] SET [Ad_Expires]='' WHERE [Advertiser]=0"
Set ConnGallery = Server.CreateOb ject("ADODB.Con nection")
ConnGallery.Ope n ConnectionStrin g
ConnGallery.Exe cute sSQL
ConnGallery.Clo se
Set ConnGallery = Nothing
Ray at work
"Julian" <ep****@shaw.ca > wrote in message
news:u3******** ******@TK2MSFTN GP11.phx.gbl...
Hi

I am trying to update a date field in my table but some how this simple code does not work, I know the select work because if I write the fields, it will show the data from the table but why the update does not work?
<%

Set ConnGallery = Server.CreateOb ject("ADODB.Con nection")
ConnGallery.Ope n ConnectionStrin g
Set cmdTemp = Server.CreateOb ject("ADODB.Com mand")

Set CmdUpdateAd = Server.CreateOb ject("ADODB.Rec ordset")
cmdTemp.Command Text = "SELECT Ads.* FROM Ads WHERE Advertiser=0 "
cmdTemp.Command Type = 1
Set cmdTemp.ActiveC onnection = ConnGallery
CmdUpdateAd.Ope n cmdTemp, , 1, 3

CmdUpdateAd.Fie lds("Ad_Expires ") = " "
CmdUpdateAd.Upd ate
CmdUpdateAd.Clo se

response.Write ("hej")

%>

Jul 19 '05 #2

Thanks Ray.

I did as you suggested, made a new file like this:

<%@ LANGUAGE="VBSCR IPT" %>
<!--#INCLUDE FILE="../dataconn_inc.as p"-->
<!--#INCLUDE FILE="../config_inc.asp"-->

<%
' to put the date for all non-advertiser to blank.
sSQL = "UPDATE [Ads] SET [Ad_expires]='' WHERE [Advertiser]= 0"
Set ConnGallery = Server.CreateOb ject("ADODB.Con nection")
ConnGallery.Ope n ConnectionStrin g
ConnGallery.Exe cute sSQL
ConnGallery.Clo se
Set ConnGallery = Nothing
response.Write ("hej")

%>

run the code and it executes without any error, the problem is that
database do not get updated.
Advertiser is type YES/NO
Ad_Expires is short date
and both defined so, they can be emty. My connection is correct since I
can get all the rows listed when I write it.
Any idea?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #3
If you try to set a date/time column to '' in Access, you will get a data
conversion error. I suggest either setting the date to something like
1/1/1900, or setting it to null, depending on which would work better in
your environment.

sSQL = "UPDATE [Ads] SET [Ad_expires]=#1/1/1900# WHERE [Advertiser]= 0"
or
sSQL = "UPDATE [Ads] SET [Ad_expires]=NULL WHERE [Advertiser]= 0"

Ray at work

"Julian Caine" <we*******@gent lemenworld.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..

Thanks Ray.

I did as you suggested, made a new file like this:

<%@ LANGUAGE="VBSCR IPT" %>
<!--#INCLUDE FILE="../dataconn_inc.as p"-->
<!--#INCLUDE FILE="../config_inc.asp"-->

<%
' to put the date for all non-advertiser to blank.
sSQL = "UPDATE [Ads] SET [Ad_expires]='' WHERE [Advertiser]= 0"
Set ConnGallery = Server.CreateOb ject("ADODB.Con nection")
ConnGallery.Ope n ConnectionStrin g
ConnGallery.Exe cute sSQL
ConnGallery.Clo se
Set ConnGallery = Nothing
response.Write ("hej")

%>

run the code and it executes without any error, the problem is that
database do not get updated.
Advertiser is type YES/NO
Ad_Expires is short date
and both defined so, they can be emty. My connection is correct since I
can get all the rows listed when I write it.
Any idea?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #4

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

Similar topics

2
14169
by: Mike | last post by:
I am sure that I am making a simple boneheaded mistake and I would appreciate your help in spotting in. I have just installed apache_2.0.53-win32-x86-no_ssl.exe php-5.0.3-Win32.zip Smarty-2.6.7.tar.gz on a system running WindowsXP SP2. Apache and PHP tested out fine. After adding Smarty, I ran the following http://localhost/testphp.php
8
2207
by: tooheys | last post by:
This may be to simple for the level of material I've already seen here, but nothing ventured. I have two web page linked from http://www.rhodeisland-aa.org/ricsmeetings/index.htm They are supposed to do the same thing. These pages are Test10 and Test20 namely print out "Hello World" Test10 works (after a fashion)
12
2319
by: Fred Pacquier | last post by:
First off, sorry for this message-in-a-bottle-like post... I haven't been able to phrase my questions well enough to get a meaningful answer from Google in my research. OTOH, it is standard flattery (but true) that this group has a bunch of the nicest and most knowledgeable Usenet people around, and I know for a fact that there are some pretty good spam- related tools written in Python, so I thought I might get away with it :-) Yes,...
13
2366
by: LRW | last post by:
Having a problem getting a onSubmit function to work, to where it popsup a confirmation depending on which radiobutton is selected. Here's what I have: function checkdel() { if (document.getElementById"].value=='1') { confirm('Are you sure you want to delete this file?'); } } ......
6
1397
by: leonat | last post by:
I have an asp.net webform. When I view the page in the web browser, the html is returned but not any asp code, i.e., " <% ... %> ". This same code works in the "old" asp page BUT NOT in asp.net. See code below: _________________________________________________________________-
4
1785
by: namemattersnot | last post by:
Re, SCENARIO: User clicks a link and a javascript function creates dynamic content in <div id="content"></div> using: document.getElementById("content").innerHTML = something In the page's header I load a javascript that does nice effect to pictures. In HTML code I have the following element that contains referect for that said javascript:
17
4250
by: StevePBurgess | last post by:
A really simple script is driving me up the wall. I have a very simply facility on a website to allow the user to reorder items in a database table as she wishes by clicking a link that (in this case) says "MOVE UP" and links to the script below. This script snippet that does all the work is shown - the database connection is established and after doing its work the script returns the user to the referring page.
5
3886
by: =?Utf-8?B?SmltIFJvZGdlcnM=?= | last post by:
My question is simple: How does one debug ASP Classic with Microsoft Visual Web Developer Express 2005 ("VWD")? Looming in the back of anyone's mind when you see a posting like this on any newsgroup is "didn't this guy read the docs?" Frankly, I "sort of did" a number of times. I feel the days of "things that are intuitively obvious" to use long ago gave way to "things that are clear after a 'Hello World'" example. And those
0
2603
by: osin | last post by:
Hello everyone, I need to generate an XML file whose element would be an active link (triggering a PERL script). The only tool I've found which is capable of doing it is Xlink. The problem is that it doesn't work properly. My XML file is : <searchresult xmlns:xlink="http://www.w3.org/1999/xlink"> <account> <accountpoid xlink:type="simple" xlink:show="replace" xlink:href="http:/localhost/cgi-bin/sample12_copy.pl">16213</accountpoid>...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10214
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7410
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5304
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3963
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3563
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.