Wrox Programmer Forums
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics 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 July 5th, 2007, 11:26 AM
Authorized User
 
Join Date: Oct 2006
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Default ElseIF

I'm trying to write a statement saying if PD is selected and the difference between date1 and date2 is less than 10, then the amount should equal 100. If it's equal or more than 10, the amount should equal 50. but the error I keep receiving is.....


Server Error in '/FireworksPermitApp' Application.
--------------------------------------------------------------------------------

Procedure 'spInsertTempFWPermitTables' expects parameter '@mAmount', which was not supplied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Procedure 'spInsertTempFWPermitTables' expects parameter '@mAmount', which was not supplied.

I know it's not entering an amount but I don't know how to code it so that the it'll go thru. When I choose the others the amount shows up. But when I choose PD I get this error. Here's my code...

 Dim date1, date2, strDateDiff
        date1 = txttodaydate.Text
        date2 = txtddate.Text
        strDateDiff = DateDiff("yyyy", date2, date1)

        Dim prmAmount As New SqlParameter("@mAmount", SqlDbType.Money)
        If ddlFWClass.SelectedItem.Value = "D" Then
            prmAmount.Value = 2000
        ElseIf ddlFWClass.SelectedItem.Value = "M" Then
            prmAmount.Value = 2000
        ElseIf ddlFWClass.SelectedItem.Value = "R" Then
            prmAmount.Value = 200
        ElseIf ddlFWClass.SelectedItem.Value = "W" Then
            prmAmount.Value = 700
        ElseIf ddlFWClass.SelectedItem.Value = "SR1" Then
            prmAmount.Value = 100
        ElseIf ddlFWClass.SelectedItem.Value = "SR2" Then
            prmAmount.Value = 200
        ElseIf ddlFWClass.SelectedItem.Value = "PD" Then
        Else
            If strDateDiff < 10 Then
                prmAmount.Value = 100
            Else
                prmAmount.Value = 50
            End If
        End If

Can someone help me?

 
Old July 5th, 2007, 12:07 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hey there... you miss the value in the case of "PD" ;)

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old July 5th, 2007, 12:42 PM
Authorized User
 
Join Date: Oct 2006
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm sorry but I don't get exactly what you mean. It has to be pd and less than ten days or pd and more than ten days? Once they choose pd it has to decide where or not it's less or more than ten days.

 
Old July 5th, 2007, 12:48 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

if the choose if "PD" then the parameter is not getting any value...

Code:
...
       ElseIf ddlFWClass.SelectedItem.Value = "PD" Then
            prmAmount.value = (some value)
        Else
            If strDateDiff < 10 Then
                prmAmount.Value = 100
            Else
                prmAmount.Value = 50
            End If
        End If
unless you really want to do something else and your code is wrong...

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old July 5th, 2007, 12:57 PM
Authorized User
 
Join Date: Oct 2006
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks






Similar Threads
Thread Thread Starter Forum Replies Last Post
If then Elseif systax error alisonchase ASP.NET 1.0 and 1.1 Basics 3 January 30th, 2005 07:50 AM





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