title: Accessing values from partial classes
body: <p>Please help! I'm still learning so this might be completely wrong. I have built a multi-user web application for internal purposes. I have split my code up to make it more manageable and have run into some problems. I suspect that I have done something very silly!</p>
  
  <p>I have a class in a separate file (quoteStatus.vb) in App_Code here it is:</p>
  
  <pre><code>Imports Microsoft.VisualBasic
  Imports System.Data.SqlClient
  Imports System.Data
  
  Public Class quoteStatusHelper
  
   Public Shared QuoteStatus As String
  
      Public Shared Sub GetQuoteStatus(ByVal QuoteID As String)
  
          Dim con As New SqlConnection
          Dim cmd As New SqlCommand
  
          Try
              con.ConnectionString = ConfigurationManager.AppSettings("quotingSystemConnectionString")
              con.Open()
              cmd.Connection = con
              cmd.CommandText = "SELECT Status FROM Quote WHERE QuoteID =" &amp; QuoteID &amp; ";"
              Dim lrd As SqlDataReader = cmd.ExecuteReader()
  
              While lrd.Read()
                  QuoteStatus = lrd("Status")
              End While
  
          Catch ex As Exception
  
          Finally
              con.Close()
          End Try
  
  
      End Sub
      End Class
  </code></pre>
  
  <p>I use this to fire the code from another file:</p>
  
  <pre><code>quoteStatusHelper.GetQuoteStatus(QuoteID)
  </code></pre>
  
  <p>Then grab the result with</p>
  
  <pre><code>Dim returnedStatus = quoteStatusHelper.QuoteStatus
  </code></pre>
  
  <p>This seems really wrong, as the value seems to be held in the partial class after the first run. So if I have two users accessing the class the public shared dim is changed for both users! There must be a better way to do this. I have looked everywhere and I'm more confused now than when I started off...</p>
  
  <p>How can I make QuoteStatus in the partial class unique to every user and access it from my code. I cant figure it out :( Please help</p>
  
  <p>Many thanks in advance.</p>