Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
mary_itohan
Posting Yak Master
191 Posts |
Posted - 2007-11-20 : 15:02:56
|
Hello,whats wrong with the code below ?Its meant to run in the global.asax fileI just want to make an object counter for all hitsMary[CODE]void Application_Start(object sender, EventArgs e) { Application("usercount") == 1 ; }[/CODE]Yes O ! |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-11-20 : 15:25:55
|
== is the comparison operator, not the assignment operator. You need to use = to assign a value.- Jeffhttp://weblogs.sqlteam.com/JeffS |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2007-11-20 : 15:27:00
|
More like this, change the brackets belowvoid Application_Start(object sender, EventArgs e) { Application["usercount"] = 1 ; } |
|
|
mary_itohan
Posting Yak Master
191 Posts |
Posted - 2007-11-20 : 15:49:07
|
Ok, thanks. However i have another error incrementing itDescription: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0019: Operator '+' cannot be applied to operands of type 'object' and 'int'Source Error: Line 31: protected void Button3_Click(object sender, EventArgs e)Line 32: {Line 33: Label2.Text = Application["usercount"] + 1 ;Line 34: }Line 35: } Yes O ! |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2007-11-20 : 16:55:34
|
Convert the Application object to integer with the convert function. |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2007-11-21 : 00:41:33
|
I'd sugest going and buying a C# book. You are going to keep running into problems with the basics of the syntax until you expand some of your background knowledge.Damian"A foolish consistency is the hobgoblin of little minds." - Emerson |
|
|
|
|
|