Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 11th, 2006, 11:10 AM
Authorized User
Points: 146, Level: 2
Points: 146, Level: 2 Points: 146, Level: 2 Points: 146, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2006
Location: , , .
Posts: 31
Thanks: 1
Thanked 0 Times in 0 Posts
Default Case Select Statements & Updating the Database

I have a Case Select Statement that is selecting what item price goes with what item. (Long and complicated, but this is what I need to do.)

I want to use the result from that Case Select to update the database with the price.

Here's the Case Statement
Code:
'--Logo Price based on LogoOption

Dim mySqlConn8 as SqlConnection
Dim mySqlCmd8 as SqlCommand
Dim LogoID as Integer
Dim LogoPrice as String

mySqlConn8 = new SqlConnection("DNS")
    mySqlCmd8 = new SqlCommand("SELECT LogoPrice FROM Logo", mySqlConn8)
    mySqlConn8.Open()

    Select Case(LogoPrice)
        Case LogoID = 1
            LogoPrice = "4.25"
        Case LogoID = 2
            LogoPrice = "4.25"
        Case LogoID = 3
            LogoPrice = "1.10"
        Case LogoID = 4
            LogoPrice = "1.10"
        Case LogoID = 5
            LogoPrice = "0.00"
    End Select
    mySqlConn8.Close()
And here is the update statements I'm using.

Code:
UpdateCMD.Parameters.Add("@LogoPrice", SqlDbType.Money, 8).Value = LogoPrice.Text
How do I get the result from the Case Statement to my Update Statement? I know its syntax, and I have tons of problems with syntax. I also know I probably didn't put the right code blocks here for you to look at. Just let me know what you need.

Help!

Reply With Quote
  #2 (permalink)  
Old April 11th, 2006, 11:47 AM
Authorized User
Points: 146, Level: 2
Points: 146, Level: 2 Points: 146, Level: 2 Points: 146, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2006
Location: , , .
Posts: 31
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thought I'd forward the error message I get with the above setup.

Code:
System.FormatException: Input string was not in a correct format.
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior 
cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at 
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at 
ASP.OrderPage_aspx.AddToCart(Object s, EventArgs e) in 
D:\Inetpub\Intranet\Apparel\OrderPage.aspx:line 269
With Line 269 being the Update Statement.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating database & saving it to another file OnceANewbie VB Databases Basics 1 December 1st, 2008 06:58 AM
Switch Case statements ermy78 Access VBA 3 October 20th, 2006 08:58 AM
CASE Statements in T-SQL atcs2152 SQL Server 2000 3 April 28th, 2006 10:53 AM
Case Statements cfriedberg SQL Server 2000 1 September 7th, 2005 08:46 PM
Case Statements in Access dbegg Access 2 September 17th, 2003 04:30 PM



All times are GMT -4. The time now is 03:34 PM.


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