Solved

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

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now