We help IT Professionals succeed at work.
Get Started

using a function getting  BC30451 error

duppypog asked
Last Modified: 2012-05-11
I'm still coding in VS 2003, ASP.NET 1.1 because I work in the public sector and we have no money for training. I have one line of code, that calls one function that already works perfectly in other applications, but I cannot find one difference to figure out why it's not working here. The code uses a function to return an image.

The .apsx page reads:
<asp:Image Runat="server" Width="100" AlternateText="Photo Unavailable" ImageUrl='<%# GetImg(Container.DataItem("ImageID")) %>' ID="Image1" ></asp:Image>

The Function looks like this:
    Public Function GetImg(ByVal sImg As Object) As String
            With sImg
                If sImg Is DBNull.Value Then
                    sImg = "Imgs\nophoto.gif"
                    sImg = "http://www.hcso.org/Records/Images/" & sImg & ".jpg"
                    'Response.ContentType = "image/jpeg"
                End If
            End With
            Return sImg
            lblError.Text = sImg
        Catch ex As Exception
            lblError.Text = ex.ToString
        End Try
    End Function

Does anyone see any reason why this would not work like in the other apps???
Thank you!
Watch Question
This problem has been solved!
Unlock 4 Answers and 7 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE