Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 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 4th, 2006, 01:16 PM
Registered User
 
Join Date: Apr 2006
Location: barcelona, katlunya, Spain.
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.

Reply With Quote
  #2 (permalink)  
Old April 4th, 2006, 01:19 PM
Friend of Wrox
 
Join Date: Dec 2005
Location: , , .
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.

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
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



All times are GMT -4. The time now is 05:25 AM.


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