|
Mohammed Gouda wrote: I imagined that there is Adapter.Clear(DataSet) or anything similar
To clear a DataSet, you don't need an adapter. DataSet.Clear()[^] does the job.
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
|
Don't feel bad about asking 'silly' questions or being a newbie; everybody was at some stage.
A word of advice, though - don't delete questions after they've been answered.
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
Hi,
I got a very simple XML file:
<rss version="2.0">
<channel>
<book>Book title
And want to have it printed in my c# application.
It should open the xml file from my website (http://my-website.com/books.rss), and then echo what's inside <book>.
Can anyone make simple and lightweight code do do that?
|
|
|
|
|
I can't connect app to SQLEXPRESS via the local network.
It works on same PC.
In SQL Server Configuration Manager > SQL Server 2005 Network Configuration > Protocols for SQLEXPRESS > TCP/IP and Named Pipes - set to Enabled.
In Server Properties > Security > SQL Server and Windows Authentication mode is set.
Firewall and antivirus are stopped during tests.
What else can be cause of this trouble?
Thanks for any help.
|
|
|
|
|
What is the error message?
What does your connection string look like?
What are the instance names of the two SQLEXPRESS servers?
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Thank you for your answer. More precisely:
Error message:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Connection string:
mConnection = new SqlConnection(@"data source= computerNameServer\sqlexpress;" +
"database=myDatabase;" +
"UID=x; PWD=y;");
|
|
|
|
|
And the instance name on the other computer really is 'sqlexpress'?
I'm quite sure the instance name is case insensitive, but you could give it a try. By default, the instance name is SQLEXPRESS, IIRC.
Did you restart the computer after modifying the remote access settings for SQLServer?
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
It's quite easy to get the current type from an instance method e.g. this.GetType() but is it possible to get the name of the current type from within a static method?
For example:
class MyClass
{
static void MyMethod()
{
// how to get the current type from here
}
}
Wal
http://www.waleedeissa.com
|
|
|
|
|
Interesting question.
Can be solved using StackFrame :
class MyClass
{
static void MyMethod()
{
StackFrame sf = new StackFrame();
MethodBase mb = sf.GetMethod();
Debug.WriteLine("Currently in "+mb.DeclaringType.ToString()+"."+mb.Name+"()");
}
}
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
> Interesting question.
and a more interesting answer, thanks a lot
Wal
http://www.waleedeissa.com
|
|
|
|
|
Never rely on StackFrame, you might get different results when the JIT decides to inline the call to your method.
|
|
|
|
|
Huh? Never saw anything like this documented anywhere.
This would mean that StackFrame is completely useless because you could never be sure what the JIT is doing...
Do you have any proof for your claim?
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
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" ..
|
|
|
|