Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access 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 April 4th, 2006, 01:16 PM
Registered User
 
Join Date: Apr 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default casting

hello


  I have retrived some data from database. Now I want to compare that data with my string value. Although the data retrived and my string value are same and the if condition is true but still it doesnt execute the code inside the if condition.

I think there is some problem with casting. The code is as follows:


mycommand = New SqlCommand("select balqtyp, balqtyc, partida, Description from inwards where partida = (select min(partida) from inwards where model_no = '" + modelno + "' and warehouse = '" + warehouse1 + "')", con)

            mycommand.Connection = con

            dr = mycommand.ExecuteReader()
            Dim pallets, cajas, partida, description As String

            Do While dr.Read
                pallets = dr.Item("balqtyp")
                cajas = dr.Item("balqtyc")
                partida = dr.Item("partida")
                description = dr.Item("description")
            Loop

            warehouse1 = warehouse1.TrimEnd
            warehouse1 = warehouse1.TrimEnd
            warehouse1 = warehouse1.Trim

             If warehouse1.Equals("polistock") = True Then
                rbpolistock.Checked = True
                rbmasdatran.Enabled = False
                rbnaypemar.Enabled = False
                rbnihal.Enabled = False
           end if


please help me. Thanx a lot in advance.

 
Old April 4th, 2006, 01:19 PM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Set a breakpoint at the beginning and track the values of warehouse1 from line to line, that might help you figure out a way around the casting issues.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Casting pfrigo BOOK: Professional .NET 2.0 Generics 3 November 19th, 2007 04:49 PM
Casting - Can you help koco C# 1 September 24th, 2007 08:41 AM
Casting Problem liorlankri ASP.NET 1.x and 2.0 Application Design 2 January 2nd, 2007 03:31 AM
Casting question shantawn J2EE 4 August 2nd, 2005 02:40 AM
Dynamic Casting pareshsoft C# 2 December 1st, 2004 12:12 AM





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