Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 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 January 10th, 2007, 09:42 AM
Authorized User
 
Join Date: Aug 2006
Location: , , USA.
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm getting the following error
BC30408: Method 'Public Function GetSalesman() As Object' does not have the same signature as delegate 'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'.


 
Old January 10th, 2007, 09:45 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Are you using Addhandler somewhere?

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature
 
Old January 10th, 2007, 09:47 AM
Authorized User
 
Join Date: Aug 2006
Location: , , USA.
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No, What is that?

 
Old January 10th, 2007, 10:01 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

On your front end do this:

<asp:Label id=lbl2 runat=server />

On your backend do this:
Private Sub Page_Load(ByVal sender as Object, ByVal e as EventArgs)
If not Page.IsPostBack
     lbl2.Text = GetSalesman()
End If
End Sub

Ill explain Addhandler after we deal with this problem.

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature
 
Old January 10th, 2007, 10:05 AM
Authorized User
 
Join Date: Aug 2006
Location: , , USA.
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Now I'm getting
System.InvalidCastException: Cast from type 'DataSet' to type 'String' is not valid

 
Old January 10th, 2007, 10:11 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

....so change the signature of your function to [function declaration] as string and return a value from your dataset.

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature
 
Old January 10th, 2007, 10:26 AM
Authorized User
 
Join Date: Aug 2006
Location: , , USA.
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Something like this:

Function GetSalesman (ByVal FieldName As String) As String

End Function

 
Old January 10th, 2007, 10:29 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Yes

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature
 
Old January 10th, 2007, 10:44 AM
Authorized User
 
Join Date: Aug 2006
Location: , , USA.
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm getting:

BC30311: Value of type 'System.Data.DataSet' cannot be converted to 'String'


Dim a As String
Sub Page_Load(sender As Object, e As EventArgs)
      If not Page.IsPostBack
          a = Context.User.Identity.Name
         lbl2.Text = GetVendedor(a)
      End If
End Sub

Function GetVendedor (ByVal FieldName As String) As String
//some code
End Function

 
Old January 10th, 2007, 10:53 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

You cannot just return your dataset as I imagine you are doing something like this:

Return ds

That is why you are getting the error. You have to access your Dataset, then the datatable contained inside the dataset, and then retrieve the value that you want to work with.

ds.Tables[0].Rows[0].Item["columnname"]

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature




Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Bind Data in DataGrid akumarp2p C# 2005 2 December 30th, 2006 12:11 PM
Grid Bind msbsam ASP.NET 2.0 Basics 1 December 19th, 2006 07:03 AM
Bind Data to a Single Label Control: Possible? jumpseatnews ASP.NET 2.0 Basics 1 April 6th, 2006 11:12 PM
how to bind a data() lsxx Classic ASP Components 4 April 20th, 2005 02:35 AM
bind variable htummala Oracle 1 February 15th, 2005 05:32 AM





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