Advertisement

03.27.2008 at 12:23PM PDT, ID: 23275276
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

vb.net, sql, IE, Cannot refer to an instance member of a class from within a shared method or shared member initializer without and explicit instance of the class, When I remove shared I get this err

Tags: vb.net, sql, IE, Cannot refer to an instance member of a class from within a shared method or shared member initializer without and explicit instance of the class, When I remove shared I get this error Reference to a non-shared member requires an object reference
I am very new at this so please keep the answer/ideas simple if possible.  Don't know if this question is Extremely difficult because almost eveything is Extremely difficult to me right now even the simple things. Thanks in advance!

I am making a web service with multi web referances. I had a common.vb with functions I removed most of the functions to a CommonTime.vb and made it a web references. My service to hits the common for the database functions only.

In my common.vb If
I keep the Shared in the function I get an error on CommonTimeWebRef
I remove Shared I get an error in my CustServDAL.vb

Public Shared Function GetROSSProduction(ByVal StartDate As DateTime, ByVal EndDate As DateTime, ByVal RowID As Integer) As DataSet
        ' This function is used to query all ROSS data for this web service
        ' RowID = ID in database

        StartDate = CommonTimeWebRef.EasternToCentral(StartDate)
        EndDate = EasternToCentral(EndDate)

        Dim strSQL As String = GetROSSSQLCommand(RowID)
        If strSQL = "Error" Then
            Return Nothing

        End If

        strSQL = Replace(strSQL, "&PARAM1", StartDate)
        strSQL = Replace(strSQL, "&PARAM2", EndDate)

        Try

            Dim DSProd As DataSet
            Dim db As OracleDatabase = DatabaseFactory.CreateDatabase("ROSS")
            Dim sqlCommand As String = strSQL

            Dim dbCommand As OracleClient.OracleCommand = db.GetSqlStringCommand(sqlCommand)
            DSProd = db.ExecuteDataSet(dbCommand)

            Return DSProd

        Catch ex As System.Exception
            LogErrorToDB("ProdLibWS.GetROSSProduction", ex, "App_Code/Common #24 (GetROSSProduction) - " & AppSettings("Server"))

            Return Nothing

        End Try

    End Function
 

CustServDAL.vb on GetROSSProduction
CODE

Public Function GetShippingSawPG(ByVal StartDate As DateTime, ByVal EndDate As DateTime) As DataSet

        Try

            Dim dsProd As Object = GetROSSProduction(StartDate, EndDate, 2)
            If Not dsProd Is Nothing Then Return dsProd Else Return Nothing

        Catch ex As Exception
            WebRefError.LogErrorToDB("ProdLibWS", "Error is in GetShippingSawPG Function: " & ex.Message, "Location CustSerDAL Function #68", "1", "dsProd", "Function", "GetShippingSawPG: " & ex.Source, ex.StackTrace)

            Return Nothing

        End Try

    End Function

I am pretty sure I need the CommonTimeWebRef.EasternToCentral(StartDate)in the Public Shared Function GetROSSProduction to hit my web service other wise it just keeps hitting the EasternCentral that is in the Common.vb
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: RVivo33
Solution Provided By: jensfiederer
Participating Experts: 1
Solution Grade: B
Views: 25
Translate:
Loading Advertisement...
03.28.2008 at 05:36AM PDT, ID: 21229749

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.28.2008 at 05:39AM PDT, ID: 21229772

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.28.2008 at 07:24AM PDT, ID: 21230649

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.28.2008 at 07:32AM PDT, ID: 21230741

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.28.2008 at 08:01AM PDT, ID: 21231022

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • Automotive
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Displays / Monitors
  • Handhelds / PDAs
  • Components
  • Peripherals
  • Laptops/Notebooks
  • Servers
  • Misc
  • Apple
  • Embedded Hardware
  • Networking Hardware
  • Storage
  • Desktops
  • New Users
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMware
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Virtualization
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • Web Computing
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Consulting
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMware
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Automation
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Web Services
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Web Computing
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Lounge
  • Business Travel
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
  • Automotive
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
03.28.2008 at 05:36AM PDT, ID: 21229749

Rank: Guru

"Shared" is not just a decoration to put on or take off  - it means that the method is effectively global, and is not using the state of any ONE instance of the class.  These are often used to RETURN instances, such as query methods.

I'll take a look at your specifics here.
 
03.28.2008 at 05:39AM PDT, ID: 21229772

Rank: Guru

Your function is JUST the type that SHOULD be static.

The problem is in CommonTimeWebRef.EasternToCentral, which looks like you are just using it to make a time conversion.

THAT one is made to be called with a specific instance of its class.
 
03.28.2008 at 07:24AM PDT, ID: 21230649
You are right I am just using the CommonTimeWebRef.EasternToCentral to convert the time. I think I have been reading more information and think what you are saying and what I have read is that my Function in the CommonTimeWebRef needs to be Shared.  Do appreciate you help! I am very new and do not understand all the terminology uses on MSDN and in other examples. This is my first project. If fact if you can suggest the best book or anything it would be appreciated. I do not expect or wnat the answer just a lead in the right direction would be great. So please if I am not understanding what I am reading or what you are explaining please be patient. Thanks
 
03.28.2008 at 07:32AM PDT, ID: 21230741

Rank: Guru

> what you are saying and what I have read is that my Function in the CommonTimeWebRef needs to be Shared

If this is a function you are writing yourself, the answer is YES, there does not seem to be any reason for EasternToCentral NOT to be shared.

However, if CommonTimeWebRef  is a class from somebody ELSE, and you are stuck with it, then:

' syntax might vary if CommonTimeWebRef has no default constructor
Dim TimeConverter as new CommonTimeWebRef
StartDate = TimeConverter .EasternToCentral(StartDate)


Should work - you are allocating an INSTANCE of CommonTimeWebRef, and EasternToCentral is meant to be called on an INSTANCE.
Accepted Solution
 
03.28.2008 at 08:01AM PDT, ID: 21231022
Got it! Thanks although this is what I did and it works. I added

#Region "Fields"
    Public CommonClass As Common

#End Region

and then added the CommonClass. to all my other functions and it works

 Dim dsProd As Object = CommonClass.GetROSSProduction(StartDate, EndDate, 2)

I know it should of worked with my
Imports Common but it did not and I do not know why but thats ok for right now.

Thanks for your help
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628