Update Table

This is a discussion on "Update Table" within the Classic ASP section. This forum, and the thread "Update Table are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Sep 5th, 2003, 22:27
Junior Member
Join Date: Aug 2003
Location: USA
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Update Table

I have the worse time with date functions working. I'm using MSSQL2k and FP with ASP. What I need to do is take an existing date in the database and increment it by one year.

The Table values are:
Field Name: Sponsored
varchar 18
('(convert(varchar(12),(getdate(),101 + 30),101))')

This works with no problem.

The script below should take the current or existing date and update it with a new one. What I get is "0" in the table. If I response.write <%key10%>, I get the correct info displayed on the page.

Can someone look at the code that performs the AddDate function, and the update table function to see what it is I'm missing or have wrong.


<meta http-equiv="Content-Language" content="en-us">
<%
Set RS = Server.CreateObject("ADODB.Recordset")
set myConn = Server.CreateObject("ADODB.Connection")
tkey = key


Dim HTTP_REFERRER
Response.ExpiresAbsolute = Now() - 1
Response.AddHeader "Cache-Control", "no-cache"
If Not(IsObject(Session("OBIT"))) Then
If Session("OBIT") = "" Then
HTTP_REFERRER = Request.ServerVariables("URL")
If Request.QueryString <> "" Then HTTP_REFERRER = HTTP_REFERRER & "?" & Request.QueryString
Response.Redirect "login.asp?HTTP_REFERRER=" & Server.URLEncode(HTTP_REFERRER)
End If
End If
%>

<%

'get key
key10 = DateAdd("yyyy", +1, Session("OBIT").Item("Sponsored"))
Key = Session("OBIT").Item("ID")

%>

<%

tkey = key10
skey = Key
myConn.Open xDb_Conn_Str

newSQL = "Update Obituary SET Sponsored = "&tkey&" WHERE ID ="&skey
myConn.Execute(newSQL),,adexecutenorecords

myConn.close
set myConn = Nothing

' If Err <> 0 Then
'Response.Write "Error encountered: " & Err.Description
'Else
'response.redirect "SponsorGuestregisterthankyou.asp"
'End If


%>




<%=Key10%>
</p>

Thanks for assistance

Ernest L. Kendricks

  #2 (permalink)  
Old Sep 8th, 2003, 08:28
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
try:

Sponsored = '"&tkey&"' WHERE

or:

Sponsored = '#"&tkey&"#' WHERE

Does that help?
Closed Thread

Tags
update, table

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Am I using table-cell and table-row too much? idl Web Page Design 15 Sep 7th, 2006 12:55
Need to align width of Float table with the table below Vertabase Web Page Design 4 Mar 8th, 2006 21:21
MySQL UPDATE after use $uniqueID to find table row, etc jswebdev PHP Forum 1 Dec 6th, 2005 12:09


All times are GMT. The time now is 04:44.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43