Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 7th, 2006, 10:01 AM
Friend of Wrox
 
Join Date: May 2005
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
Default What's wrong with Update

What is Wrong with this code? The variable (like varhoyde) does not hold any relevant value. The value which is transferred into the db is "varhoyde"!

Thank you for spending your time...

<% option explicit
dim link
 %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
    <title>registrering_1_mann_sjekk</title>
</head>

<body>
<%

dim varhoyde,varhaar,varoye,varvekt

Select Case Request.QueryString("hoyde")

'a set of radiobuttens, same name, different values

    Case "150"
        varhoyde = "150"
    Case "155"
        varhoyde = "155"
    Case "160"
        varhoyde = "160"
    Case "165"
        varhoyde = "165"
    Case "170"
        varhoyde = "170"
    Case "175"
        varhoyde = "175"
    Case "180"
        varhoyde = "180"
    Case "185"
        varhoyde = "185"
    Case "190"
        varhoyde = "190"
    Case "195"
        varhoyde = "195"
    Case "200"
        varhoyde = "200"
    Case "205"
        varhoyde = "205"
    Case Else
End Select



Select Case Request.QueryString("haar")
    Case "lys_blond"
        varhaar = "lys_blond"
    Case "blond"
        varhaar = "blond"
    Case "mork_blond"
        varhaar = "mork_blond"
    Case "brun"
        varhaar = "brun"
    Case "mork_brun"
        varhaar = "mork_brun"
    Case "lys_brun"
        varhaar = "lys_brun"
    Case "sort"
        varhaar = "sort"
    Case "rod"
        varhaar = "rod"
    Case "graa"
        varhaar = "graa"
    Case "annet"
    Case Else
End Select




Select Case Request.QueryString("oye")
    Case "blaa"
        varoye = "blaa"
    Case "gronn"
        varoye = "gronn"
    Case "graa"
        varoye = "graa"
    Case "sort"
        varoye = "sort"
    Case "brun"
        varoye = "brun"
    Case Else
End Select



Select Case Request.QueryString("vekt")
    Case "50"
        varvekt = "50"
    Case "55"
        varvekt = "55"
    Case "60"
        varvekt = "60"
    Case "65"
        varvekt = "65"
    Case "70"
        varvekt = "70"
    Case "75"
        varvekt = "75"
    Case "80"
        varvekt = "80"
    Case "85"
        varvekt = "85"
    Case "90"
        varvekt = "90"
    Case "95"
        varvekt = "95"
    Case "100"
        varvekt = "100"
    Case "105"
        varvekt = "105"
    Case "110"
        varvekt = "110"
    Case "115"
        varvekt = "115"
    Case Else
End Select



dim objComm,objRs

set objComm = server.createobject("ADODB.Command")


    objComm.ActiveConnection = link

    objComm.CommandText = "UPDATE Produkt SET ProduktHoyde = 'varhoyde', ProduktHaar = 'varhaar', ProduktOye = 'varoye', ProduktVekt = 'varvekt' WHERE ProduktNavn LIKE '" & session("innsjekknavn") & "';"
    objComm.CommandType=adCmdText
    Set objRs = objComm.Execute

Set objComm = Nothing
Set objRs = Nothing

Med vennlig hilsen
grstad

%>


<%= varhoyde %>

</body>

</html>


__________________
Internet has become favorable with that tool...thank you Tim Berners-Lee!
 
Old March 7th, 2006, 08:15 PM
Authorized User
 
Join Date: Feb 2006
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi !

Why you make a select case ?

varhoyde = Request.QueryString("hoyde")

you look if Request.QueryString("hoyde") is a value and if is a number in your SQL update no comma inser

... ProduktHoyde = varhoyde,....


Steweb




Visit my web site !
www.steweb.net
 
Old March 7th, 2006, 10:04 PM
Wrox Technical Editor
 
Join Date: Dec 2005
Posts: 271
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm not sure exactly what your problem is, but here are some suggestions:

If your query string doesn't contain "hoyde" then "varhoyde" will never have a value.

You could do the following for further error testing:

dim varhoyde,varhaar,varoye,varvekt
varhoyde = "-1"

or modify your Request.QueryString("hoyde") case:

    Case "205"
        varhoyde = "205"
    Case Else
        varhoyde = "-1"

If the value in your database is -1 you should have a better idea of where the bug is.

- A.Kahtava
 
Old March 8th, 2006, 04:04 AM
Friend of Wrox
 
Join Date: May 2005
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hallo!

I,m trying to post radiobutton-values into a access db.
But the value of my variables which are displayed,
are just the word "varhoyde"!!

The variable holds no number-value as planed.

The Case-stuff maight not be a relevant metode,
I am simply tying to catch the radio-button values and
transfer them into the db.

Med hilsen grstad

 
Old March 8th, 2006, 04:30 AM
Friend of Wrox
 
Join Date: May 2005
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
Default

..."hoyde" in QueryString is the name of the radiobutton-group!

grstad






Similar Threads
Thread Thread Starter Forum Replies Last Post
update multiple columns in an update statement debbiecoates SQL Server 2000 1 August 17th, 2008 04:01 AM
Update link doesn't update in FormsView shaly ASP.NET 2.0 Basics 0 December 6th, 2006 04:33 PM
Wrong Update grstad Classic ASP Basics 18 March 16th, 2006 07:29 PM
Datagrid.update() and DataAdapter.Update aarunlal ASP.NET 2.0 Professional 2 February 23rd, 2006 11:41 PM
What is wrong with this update statment ? method SQL Server 2000 2 April 23rd, 2005 04:45 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.