Reply
VBSCRIPT from sql 2000 to sql 2008
Old 11-05-2009, 07:41 AM VBSCRIPT from sql 2000 to sql 2008
Novice Talker

Posts: 5
Trades: 0
Hello all,

I have a VBSCRIPT that works perfect with SQL 2000 but doesn't work with sql 2008 . any help please?

<%
dim rs, strSQL, action, id
dim headline, news_date, copy, sub_heading, author

id = trim(request.form("id"))
headline = trim(request.form("headline"))
sub_heading = trim(request.form("sub_heading"))
news_date = trim(request.form("news_date"))
author = trim(request.form("author"))
copy = trim(request.form("copy"))
headline = Replace(headline, "'", "''", 1, -1, 1)
news_date = Replace(news_date, "'", "''", 1, -1, 1)
author = Replace(author, "'", "''", 1, -1, 1)
copy = Replace(copy, "'", "''", 1, -1, 1)


set rs = server.createobject("ADODB.RECORDSET")

if id = "" then
'Insert record
strSQL = "insert into tbl _news (headline, sub_heading, news_date, author, copy) values ("
strSQL = strSQL & "'" & headline & "', "
strSQL = strSQL & "'" & sub_heading & "', "
strSQL = strSQL & "'" & getLongDate(news_date) & "', "
strSQL = strSQL & "'" & author & "', "
strSQL = strSQL & "'" & copy & "')"
else
'Update the record.
strSQL = "update tbl _news set "
strSQL = strSQL & "headline = '" & headline & "', "
strSQL = strSQL & "sub_heading = '" & sub_heading & "', "
strSQL = strSQL & "news_date = '" & getLongDate(news_date) & "', "
strSQL = strSQL & "author = '" & author & "', "
strSQL = strSQL & "copy = '" & copy & "' "
strSQL = strSQL & "where id = " & id
end if
dCmd.CommandText = strSQL
dCmd.CommandType = 1
set rs = dCmd.execute

set rs = nothing
set dCmd = nothing

response.redirect("main.asp")
%>
cafeolai is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 11-05-2009, 07:52 AM Re: VBSCRIPT from sql 2000 to sql 2008
chrishirst's Avatar
Super Moderator

Posts: 22,198
Location: Blackpool. UK
Trades: 0
Define "doesn't work"
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-05-2009, 08:08 AM Re: VBSCRIPT from sql 2000 to sql 2008
Novice Talker

Posts: 5
Trades: 0
sorry i can't really expand as the only error i get is :
500 - Internal server error.

There is a problem with the resource you are looking for, and it cannot be displayed.
cafeolai is offline
Reply With Quote
View Public Profile
 
Old 11-05-2009, 08:10 AM Re: VBSCRIPT from sql 2000 to sql 2008
chrishirst's Avatar
Super Moderator

Posts: 22,198
Location: Blackpool. UK
Trades: 0
There we are then, now at least we know it's a code error or a mispelled variable etc.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-05-2009, 08:13 AM Re: VBSCRIPT from sql 2000 to sql 2008
chrishirst's Avatar
Super Moderator

Posts: 22,198
Location: Blackpool. UK
Trades: 0
now we just need the full error message.

assuming IE as your browser.

tools -> Internet Options -> scroll down to browsing and uncheck "Show friendly HTTP error messages.

It should then tell you what the error actually is.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-05-2009, 08:20 AM Re: VBSCRIPT from sql 2000 to sql 2008
Novice Talker

Posts: 5
Trades: 0
I unchecked the Show friendly HTTP error message" and here is the error now.. not sure it helps further though..


502 - Web server received an invalid response while acting as a gateway or proxy server.

There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.
cafeolai is offline
Reply With Quote
View Public Profile
 
Old 11-05-2009, 08:26 AM Re: VBSCRIPT from sql 2000 to sql 2008
Novice Talker

Posts: 5
Trades: 0
I am sure it is a code that SQL 2008 doesn't like and not a mispelled variable as the code works perfectly with sql 2000..
cafeolai is offline
Reply With Quote
View Public Profile
 
Old 11-05-2009, 08:34 AM Re: VBSCRIPT from sql 2000 to sql 2008
chrishirst's Avatar
Super Moderator

Posts: 22,198
Location: Blackpool. UK
Trades: 0
It means there is something wrong with the way you are sending data or the server is not configured for the way you sent the request.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-05-2009, 08:55 AM Re: VBSCRIPT from sql 2000 to sql 2008
Novice Talker

Posts: 5
Trades: 0
This one work absolutely fine with sql 2008 , can you see any difference ?.. I can't


<%@LANGUAGE="VBSCRIPT" %>
<% Option Explicit %>
<!--#include file="includes/connection.asp" -->
<!--#include file="includes/dateConversions.asp" -->
<!--#include file="includes/securityLock.asp" -->
<%
dim rs, strSQL, sDebug, action, id
dim institution, full_name, address1, address2, town, county, postcode, mobile_tel, home_tel, email, year_of_graduation

institution = trim(request.form("institution"))
full_name = trim(request.form("full_name"))
address1 = trim(request.form("address1"))
address2 = trim(request.form("address2"))
town = trim(request.form("town"))
county = trim(request.form("county"))
postcode = trim(request.form("postcode"))
mobile_tel = trim(request.form("mobile_tel"))
home_tel = trim(request.form("home_tel"))
email = trim(request.form("email"))
year_of_graduation = trim(request.form("year_of_graduation"))

full_name = Replace(full_name, "'", "''", 1, -1, 1)
address1 = Replace(address1, "'", "''", 1, -1, 1)
address2 = Replace(address2, "'", "''", 1, -1, 1)
town = Replace(town, "'", "''", 1, -1, 1)
county = Replace(county, "'", "''", 1, -1, 1)
postcode = Replace(postcode, "'", "''", 1, -1, 1)
mobile_tel = Replace(mobile_tel, "'", "''", 1, -1, 1)
home_tel = Replace(home_tel, "'", "''", 1, -1, 1)
email = Replace(email, "'", "''", 1, -1, 1)
year_of_graduation = Replace(year_of_graduation, "'", "''", 1, -1, 1)

'Set up database to enter rates
set rs = server.createobject("ADODB.RECORDSET")

'Update the record.
strSQL = "update tbl_members set "
strSQL = strSQL & "institution = " & institution & ", "
strSQL = strSQL & "full_name = '" & full_name & "', "
strSQL = strSQL & "address1 = '" & address1 & "', "
strSQL = strSQL & "address2 = '" & address2 & "', "
strSQL = strSQL & "town = '" & town & "', "
strSQL = strSQL & "county = '" & county & "', "
strSQL = strSQL & "postcode = '" & postcode & "', "
strSQL = strSQL & "mobile_tel = '" & mobile_tel & "', "
strSQL = strSQL & "home_tel = '" & home_tel & "', "
strSQL = strSQL & "email = '" & email & "', "
strSQL = strSQL & "year_of_graduation = '" & year_of_graduation & "' "
strSQL = strSQL & "where id = " & session("basrat_id")

dCmd.CommandText = strSQL
dCmd.CommandType = 1
set rs = dCmd.execute

set rs = nothing
set dCmd = nothing

response.redirect("main.asp")
%>
cafeolai is offline
Reply With Quote
View Public Profile
 
Old 11-05-2009, 08:58 AM Re: VBSCRIPT from sql 2000 to sql 2008
chrishirst's Avatar
Super Moderator

Posts: 22,198
Location: Blackpool. UK
Trades: 0
And is this on a different or upgraded server??

And do we get to see the code that is SENDING the request?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to VBSCRIPT from sql 2000 to sql 2008
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.13758 seconds with 13 queries