|
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
|
|
|
January 10th, 2007, 09:42 AM
|
Authorized User
|
|
Join Date: Aug 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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)'.
|
January 10th, 2007, 09:45 AM
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
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
|
January 10th, 2007, 09:47 AM
|
Authorized User
|
|
Join Date: Aug 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
No, What is that?
|
January 10th, 2007, 10:01 AM
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
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
|
January 10th, 2007, 10:05 AM
|
Authorized User
|
|
Join Date: Aug 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Now I'm getting
System.InvalidCastException: Cast from type 'DataSet' to type 'String' is not valid
|
January 10th, 2007, 10:11 AM
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
....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
|
January 10th, 2007, 10:26 AM
|
Authorized User
|
|
Join Date: Aug 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Something like this:
Function GetSalesman (ByVal FieldName As String) As String
End Function
|
January 10th, 2007, 10:29 AM
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
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
|
January 10th, 2007, 10:44 AM
|
Authorized User
|
|
Join Date: Aug 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
January 10th, 2007, 10:53 AM
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
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
|
|
|