Solved

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

Posted on 2004-04-22
3
283 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 500 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

829 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