Solved

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

Posted on 2004-04-22
3
294 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

739 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