In this way, I try to print something meaningful for my site using my class, when I write If I try, my class will not be found, it is absolutely at all.
I can not find my worth to make some beneficial for my user.
The problem is that it can not be found in all classes.
> My class:
public class announcements [get public insight]; Set; }} Public Abnones ID Hint Abnomance ID () {Abonnians Abeon Nimed RRR = = new Abnones ID (); AbonnementsidReturn.indhold = 0; SqlConnection conn1 = New SqlConnection (Configuration Manager. Select Connection ["ConnectionString"]. ToString ()); SqlCommand cmd1 = conn1.CreateCommand (); Cmd1 Connection = Connection 1; Int brugerid = Convert.ToInt32 (HttpContext.Current.Session ["id"]); Cmd1.CommandText = @ "Choose from WHEER id = @id" from Bruger; Cmd1.Parameters.AddWithValue ("@ id", bregery); Conn1.Open (); SqlDataReader Readerbrowser = CMD1 Excess Reader (); If (Readerbrüger Reid ()) {AbonnementsidReturn.indhold = Convert.ToInt32 (ReaderBrozer A ["abonnementsid"]); } Conn1.Close (); Return AbonnementsidReturn; }
How do I write my class for my content, I write it.
if (session ["aboninside"] = null) {_subscriptionId = long Purse (session ["aboninside"] .toasting ()); } And {// When I need to print my class, I like it _subscriptionId = AbonnementsidReturn.indhold (); }
I'm shooting here completely in the dark:
Public Static Class AbonanceAid {Public Stabilized Intebone Nmance Id () {Int Annonnemed; String Connection String = ConfigurationManager.ConnectionStrings ["ConnectionString"]. ToString (); {Int brugerid = Convert.ToInt32 (HttpContext.Current.Session ["id"]) by using (Var conn = new SqlConnection (connectionString)); SqlCommand cmd1 = conn.CreateCommand (); Cmd1 Connection = Conn .; Cmd1.CommandText = @ "Choose from WHEER id = @id" from Bruger; Cmd1.Parameters.AddWithValue ("@ id", bregery); Conn.Open (); SqlDataReader Readerbrowser = CMD1 Excess Reader (); If (readerbrugerA.Read ()) abonnementsid = Convert.ToInt32 (readerbruger a ["abonnementsid"]); Conn.Close (); } Return abonnementsid; }}
Then you can call it in your code:
if (session ["practice"] = null) {_subscriptionId = long Parse (Session ["AbonnementsId"] ToString ().); } Else {// When I need to print my class I like it _subscriptionId = AbonnementsId.GetAbonnementsId (); }
No comments:
Post a Comment