Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 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
  #11 (permalink)  
Old November 14th, 2006, 04:22 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

eh.. i get out of ideas here.. i always get results with executescalar... what if you take out the convert???

HTH

Gonzalo
Reply With Quote
  #12 (permalink)  
Old November 14th, 2006, 04:27 PM
Authorized User
 
Join Date: Nov 2006
Location: Lorain, OH, USA.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No results. It must be something in the stored proc. I am running out of ideas also.

Reply With Quote
  #13 (permalink)  
Old November 14th, 2006, 04:30 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

ok.. last idea..

let's try writting another SP.. can you??

Code:
CREATE PROCEDURE dbo.testprocedure
(@DisplayValue NVARCHAR(50))
AS
SET NOCOUNT ON
SELECT U.FullName FROM DropDownData D, Users U WHERE D.DropDownCategory = 'Level5' AND D.DisplayValue=@DisplayValue and D.Misc1 = U.Associate_ID
GO
can you try with that???
also in the code you will have 1 extra parameter (comment it)... and see if you get a result with executescalar.

HTH

Gonzalo
Reply With Quote
  #14 (permalink)  
Old November 14th, 2006, 04:38 PM
Authorized User
 
Join Date: Nov 2006
Location: Lorain, OH, USA.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I copied and pasted your code (I hope you don't mind) into a new procedure and I still get no results in the label I am trying to populate.



Reply With Quote
  #15 (permalink)  
Old November 14th, 2006, 04:42 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

no problem.. can you trace the code?? do you get to the line that fill the label or are you getting out with an error?????
(try this in the catch)
Code:
lblLevel5Manager.Text = ex.Message

HTH

Gonzalo
Reply With Quote
  #16 (permalink)  
Old November 15th, 2006, 08:56 AM
Authorized User
 
Join Date: Nov 2006
Location: Lorain, OH, USA.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am getting to the line with the textbox in it and when I tried the "lblLevel5Manager.text = ex.Message" it produced nothing either. Should I put the old proc back into play or keep the one that you gave me?

Reply With Quote
  #17 (permalink)  
Old November 15th, 2006, 10:08 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

do you get an error?? or you paste the code i gave you in the wrong place?? can you paste the function here like you have it now??

we will get to the bottom of it...

HTH

Gonzalo
Reply With Quote
  #18 (permalink)  
Old November 15th, 2006, 10:16 AM
Authorized User
 
Join Date: Nov 2006
Location: Lorain, OH, USA.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is the function:

Code:
    Public Function GetLevel5Manager(ByVal strCriteria As String) As DataTable
        Try
            Dim strConn As String = HttpContext.Current.Session("ConnStr")
            Dim conn As New SqlConnection(strConn)
            Dim cmd As SqlCommand
            Dim strCrit As String = Mid(strCriteria, 10, 8)

            conn.Open()
            cmd = conn.CreateCommand()
            With cmd
                .CommandText = "sp_PopulateLevel5Manager"
                .CommandType = CommandType.StoredProcedure
                .Parameters.Add("@DisplayValue", SqlDbType.NVarChar, 50)
                .Parameters.Add("@Lvl5Mgr", SqlDbType.NVarChar, 50)
                .Parameters("@DisplayValue").Value = strCrit
                .Parameters("@DisplayValue").Direction = ParameterDirection.Input
                .Parameters("@Lvl5Mgr").Direction = ParameterDirection.ReturnValue
            End With
            Dim dtLvl5Mgrs As New DataTable
            Dim da As New SqlDataAdapter
            da = New SqlDataAdapter(cmd)
            da.Fill(dtLvl5Mgrs)

            'nullcuteScalar()
            'lblLevel5Manager.Text = Convert.ToString(@Lvl5Mgr)
            'lblLevel5Manager.Text = Convert.ToString(cmd.Parameters("@Lvl5Mgr").Value)
            lblLevel5Manager.Text = nullcuteScalar
            'Return dtLvl5Mgrs

            conn.Close()




        Catch ex As Exception
            Dim sTemp As String
            sTemp = ex.Message
        End Try
    End Function

The stored procedure is the same one that you gave me


Reply With Quote
  #19 (permalink)  
Old November 15th, 2006, 10:33 AM
Authorized User
 
Join Date: Nov 2006
Location: Lorain, OH, USA.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I don't know if this is of any help but if I change the executescalar to ExecuteNonQuery I get a result of -1. Still not the result I want but it is a result.

Reply With Quote
  #20 (permalink)  
Old November 15th, 2006, 10:42 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

ok.. let's try something.. maybe i'm not explaining ok...

i want you to try this function with the SP i gave to you...
Code:
Public sub GetLevel5Manager(ByVal strCriteria As String) 
        Try
            Dim strConn As String = HttpContext.Current.Session("ConnStr")
            Dim conn As New SqlConnection(strConn)
            Dim cmd As SqlCommand
'when you trace the code be sure that this string has the rigth data and please try it in the SP alone to see if you get results
            Dim strCrit As String = Mid(strCriteria, 10, 8)
            conn.Open()
            cmd = conn.CreateCommand()
            With cmd
                .CommandText = "testprocedure" 'the one i gave you
                .CommandType = CommandType.StoredProcedure
                .Parameters.Add("@DisplayValue", SqlDbType.NVarChar, 50)
                .Parameters("@DisplayValue").Value = strCrit
            End With
            lblLevel5Manager.Text = executeScalar
            conn.Close()
        Catch ex As Exception
            lblLevel5Manager.Text= ex.Message
        End Try
    End sub
try this function.. if it still returns nothing then the parameter you are passing to the SP is bad and that's why you are not receiving any result. this should give to you the data or an exception...

HTH

Gonzalo
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
how to see a label hombre Java Basics 3 March 4th, 2008 06:15 AM
Can I call a method that populate a Label??? cp75 ASP.NET 1.0 and 1.1 Basics 2 January 12th, 2007 05:39 AM
Dynamically displaying textboxes and label lily611 General .NET 1 December 15th, 2004 06:59 PM
Dynamically populate crystal report from .NET DTCT Crystal Reports 0 November 12th, 2004 11:46 AM



All times are GMT -4. The time now is 12:26 PM.


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