|
This program prints "Main", not "Test" (.NET Version 2.0.50727.312 on Vista Ultimate 32bit):
using System;
using System.Diagnostics;
namespace StackFrameTest
{
class Program
{
public static void Main(string[] args)
{
if (Debugger.IsAttached) {
Console.WriteLine("Inlining might be disabled when using the debugger");
}
#if DEBUG
Console.WriteLine("Inlining might be disabled in debug builds");
#endif
Test();
Console.ReadKey();
}
static void Test()
{
Console.WriteLine(new StackFrame().GetMethod().Name);
}
}
}
|
|
|
|
|
that's not what I expected...
Fortunately, there's an attribute to keep the JIT from inlining if you have to rely on the correct information from StackFrame : System.Runtime.CompilerServices.MethodImplAttribute
If you write
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace StackFrameTest
{
class Program
{
public static void Main(string[] args)
{
if (Debugger.IsAttached) {
Console.WriteLine("Inlining might be disabled when using the debugger");
}
#if DEBUG
Console.WriteLine("Inlining might be disabled in debug builds");
#endif
Test();
Console.ReadKey();
}
[MethodImpl(MethodImplOptions.NoInlining)]
static void Test()
{
Console.WriteLine(new StackFrame().GetMethod().Name);
}
}
} then the output will be as one would expect.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hi,
as the method is static it is totally clear in which type your are so you can just write typeof(MyClass) .
Robert
|
|
|
|
|
It could be a derived class, though.
-^-^-^-^-^-
no risk no funk
|
|
|
|
|
Static members are not inherited. They are always called in the context of the defining class.
|
|
|
|
|
Hi all,
how to write update Query in MS Access??
in sql, we write like this "update tablename set field = '"+ +"' where field= '"+ +"'";"
but its giving an error whenever i write the same query in access......
so, could any one help me how to write "update Query in ms access plz///
Thanks in Advance.!
|
|
|
|
|
Hi,
your syntax is principally correct. What error are you getting?
Robert
|
|
|
|
|
Hi, its saying "Syntax error in UPDATE statement"
|
|
|
|
|
"update tablename set field = '"+ +"' where field= '"+ +"'";"
If the above is exactly your code. It is a matter of c# syntax
Actually you have redundant "
The correction is
"update tablename set field = '"+ +"' where field= '"+ +"';"
Also, you can truncate the smicolon of the query
"update tablename set field = '"+ +"' where field= '"+ +"'"
I hope this helps
Mohamed Gouda
Egypt
|
|
|
|
|
Hi, thanks for the reply...
i have tried these two cases: its giving error like
" ; expected "
actually this is my query statements::
string strQuery = "update UserInfo set Password = '"+ txtNewPwd.Text +"' where Password = '"+ txtOldPwd.Text +"'";
any other solution plz...
|
|
|
|
|
Make sure you use the correct spacing
However, set a break point at that statement and debug to wathc the string
Mohamed Gouda
Egypt
|
|
|
|
|
well, i did debug using break point.. Actually, it is executing the code step by step but at the end of the debugging a message box displayed "syntax error in UPDATE statement" ..
|
|
|
|
|
string strQuery = "update UserInfo set Password = '"+ txtNewPwd.Text +"' where Password = '"+ txtOldPwd.Text +"'";
In the aove string you need to take space before WHERE
Note that 'where is COMPLETELY different from ' where
This missed space makes the error
Mohamed Gouda
Egypt
|
|
|
|
|
there is space b/w ' & WHERE........
|
|
|
|
|
It might be that Password is a keyword in Access try:
string strQuery = "update UserInfo set \"Password\" = '"+ txtNewPwd.Text +"' where \"Password\" = '"+ txtOldPwd.Text +"'";
Robert
|
|
|
|
|
Hi, thanks for the help!
yes, Password is a keyword in Access. I have changed it to "pwd" & it worked very well....... Thanks!
|
|
|
|
|
Hie.I'm looking for a control in c# that can be a suitable viewer for GISMAP projects. Would you please help me?
sarv
|
|
|
|
|
Hi! What are GISMAP projects?
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hi, How can i get drive info(free/used space) in vs 2003?
(in vs 2005 there's the DriveInfo class)
thanks.
sh
|
|
|
|
|
Hi!
You can p/invoke GetDiskFreeSpaceEx to get this information.
Because GetDiskFreeSpaceEx returns ULARGE_INTEGER s, your p/invoke declaration should contain out long for these parameters.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hello,
Yesterday I was trying to do the same thing and I found your post. Here is a solution I found:
<br />
System.Management.ManagementObject disk = new System.Management.ManagementObject("win32_logicaldisk.deviceid=\"c:\"");<br />
System.Management.PropertyData freeSpace = disk.Properties["FreeSpace"];<br />
Console.WriteLine("Free space on C: drive is: {0}", freeSpace.Value.ToString());<br />
You'll need to add a reference to System.Management to your project.
In this code snippet, freeSpace.Value will contain the amount of free space in bytes as a decimal number.
BDF
|
|
|
|
|
Can any one give me a brief description about what envoy sink, server context sink and object context sink does in .NET Remoting ?
Thanks in Advance
Phanindra...
|
|
|
|
|
using C#,searching data from the database by using key and print that information
(this database very big.)
|
|
|
|
|
we can't do your work.
What you have done for this so for?
Regards,
Satips.
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Walk beside me, and just be my friend. - Albert Camus
|
|
|
|
|
Is there any way to save the user's credentials to the database and re-use them?
I wanted to run all the threads and web-service calls as background processes using user's credentials.
I have tried to searilizing user's default credentials and it looks like that is not possible.
Is there any other options?
Please adivice,
Shrini Viswanathan
|
|
|
|