Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ASP .NET - Do not recognize share function created in public class global

Posted on 2004-04-22
3
Medium Priority
?
321 Views
Last Modified: 2010-04-07
Dear experts,

I created a public shared function (called GetTableData) inside the public class Global ( Global.aspx), syntax is like this
-------------------------------------------------------------------------------------------------------------
Imports System.Web
Imports System.Web.SessionState
Imports System.Data
Imports System.Data.OracleClient

Public Class Global
    Inherits System.Web.HttpApplication

    Public Shared Function GetTableData(ByVal strSQL As String) As DataTable
        Dim MyConnection As OracleConnection
        Dim sqlOverview As String
        Dim daOverview As OracleDataAdapter
        Dim dsOverview As DataSet
        MyConnection = New OracleConnection(HttpContext.Current.Application("Connection String"))
        MyConnection.Open()
        sqlOverview = strSQL
        'Create data adapter using sql and connection
        daOverview = New OracleDataAdapter(sqlOverview, MyConnection)
        dsOverview = New DataSet
        daOverview.Fill(dsOverview, "EMP_Table")
        Return dsOverview.Tables("EMP_Table")
        MyConnection.Close()
    End Function
    .
    .
    .
End Class

----------------------------------------------------------------------------------------------------------------------

However when I reference the function in another aspx page, it says the function is not declared.

Am I missing something?

Any help is appreciated.

etalexit
0
Comment
Question by:etalexit
3 Comments
 
LVL 28

Accepted Solution

by:
mmarinov earned 2000 total points
ID: 10893993
etalexit,
I've copy paste your code
and create a file WebForm1.aspx
in the codebehind i wrote
Global and when press "." symbol the GetTableData was shown in the list
you have to use Global.GetTableData not only GetTableData

B..M
0
 
LVL 23

Expert Comment

by:rama_krishna580
ID: 10895797
0
 
LVL 20

Expert Comment

by:ihenry
ID: 10895843
This thread have the similar case,

calling a global function from .aspx page
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/Q_20956406.html
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question