|
What does "is not working" mean - an error or not the expected result? Since you are working with nchar and Turkish words, are you sure you set all the settings correctly for your connection, use the correct culture on both server and client, etc?
Is "gecmis" missing diacritic characters? I suggest to avoid non-English names for tables and columns (or at least use ASCII characters without spaces only for their names), it causes too many problems. The data to be stored may have localized content, that's something different, but also not absolutely trouble-free.
|
|
|
|
|
Bernhard Hiller wrote: What does "is not working" mean
It is working but it returns the sum of all rows. But in management studio, it brings the sum of MasaNo column with values 'Gelir'
By the way,to make it more understandable, MasaNo means TableNo and Gelir means Income.
|
|
|
|
|
That's extremely strange. Could you try
SqlCommand cmdGelir = new SqlCommand("Select SUM(Hesap), MasaNo From Gecmis Where MasaNo = 'Gelir' Group By MasaNo", sqlBaglanti);
Then loop through all the rows returned. This might help to get closer to the source of the problem. It should be exactly one row. If it is more, look at there MasaNo values...
And another point: sometimes the use of two different systems for accessing databases can cause confusion - are you sure you connect to the same database?
|
|
|
|
|
Thanks for your interest, I solved it finally.
|
|
|
|
|
this might be a very simple question but i tried to change the visibility of a label with in
a timer ticker event. here is the code segment
private void timer1_Tick(object sender, EventArgs e)
{
label1.Visible = false;
Thread.Sleep(2000);
label1.Visible = true;
}
timer interval is set to 1000 and enabled.
but the visibility is not working. once it is disappeared it doesn't show again.
any idea why this happens.
|
|
|
|
|
Think about it for a moment.
You are firing the timer every 1000 ms. When it fires you are telling the thread to sleep for 2000 ms, so if the Visible = true line fires it fires while the thread is asleep and so you will not see the effect. Next time the timer fires it makes the label invisible then sleeps again and the whole thing repeats indefinitely.
Try setting Thread.Sleep(500) (or any value less than your timer interval).
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.
|
|
|
|
|
Since you are manipulating GUI components, this must be done on the GUI thread, so your timer has to be a Windows.Forms.Timer ; however it does not make sense to have a Thread.Sleep() in code that executes on the GUI thread, as that would freeze the GUI (or not work at all).
You should implement a state machine, that changes state in the Tick handler without waiting at all. Example: if you want a 5Hz blinking label, set the timer interval to 100, and do:
private void timer1_Tick(object sender, EventArgs e) {
label1.Visible = !label1.Visible;
}
In the example, the state machine is pretty much hidden as all the state is in the label's visibility itself.
Remember: only use Thread.Sleep() in threads other than the GUI thread. And most often it is better not to use it at all.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Hello,
I been working on outlook, from few days. I could able to delete all items from Deleted items folder. But the memory remains same for PST file. I know how to compact(compress) the PST file manually.. Could any one guide me around how to implement this through an Applications.
Any references and samples highly appreciated.....
Thanks in advance....
|
|
|
|
|
I don't think there is an API to do that. It's not exposed at all.
Best wishes,
Navaneeth
|
|
|
|
|
Hi,
I want to send sms from my pc to mobile through AT commands. I have sonny ericsson k310i and Samsung Gtb 3210. Does any one of this support AT commands in text mode??
Thanks in advance.
Regards,
Aeman
|
|
|
|
|
All GSM / GPRS mobiles should support it: there is a tutorial here[^] that should help.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
Thanks. But i m not sure that some mobiles support only PDU mode not text mode.I m not getting the actual idea?
|
|
|
|
|
Hello Everybody,
I am receive information from Socket.And Now i want to filter and Get only URL.
int bytes = socket.Receive(buffer);
String str= Encoding.ASCII.GetString(buffer, 0, bytes);
So please help regarding this.
Thanks
If you can think then I Can.
|
|
|
|
|
I'm not sure I understand you fully: your are receiving data from a socket, and you want to extract a URL from it?
What does the data contain?
There are Regexes which will extract URL's from strings, but it may not work, depending on what you string holds.
For example:
public static Regex regex = new Regex(
"(?<Protocol>\\w+):\\/\\/(?<Domain>[\\w@][\\w.:@]+)\\/?[\\w\\."+
"?=%&=\\-@/$,]*",
RegexOptions.IgnoreCase
| RegexOptions.CultureInvariant
| RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled
);
public static string regexReplace =
"<Hello>";
If this doesn't help, we will need more information
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
It will not work because that information is in Encoded Form and It encoded in Unicode characters.
So Regex will not apply Here.
Thank for reply.
If you can think then I Can.
|
|
|
|
|
All string content is in Unicode: you are converting it from ASCII:
String str= Encoding.ASCII.GetString(buffer, 0, bytes);
Give a (small) sample of your data and what you are trying to extract from it.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
Information is look like this.
?d??♣♠ P????x?▬?♀?P↑???<
?+??♣♠ P??????u.??P↑?Z#G
?+??♣♠ P??lm→???→(P↑?X0?
If you can think then I Can.
|
|
|
|
|
You are going to have to look at the raw data bytes you get from the socket - it looks as if the conversion from ASCII to unicode is not good. That implies the data is probably in blocks of some form (there is a strong pattern to the data).
Try examining it as hex bytes: you may be able to discern a pattern, and work out what part is the data you are interested in.
Do you have any information about your data source?
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
Dear Sir,
Can u please describe me in detail. I am already convert it to in ascii format.
Thanks for reply
If you can think then I Can.
|
|
|
|
|
You receive your data from the socket as a stream of bytes:
int bytes = socket.Receive(buffer); Examine the bytes, rather than converting them to a unicode string. I don't know what device you are getting your data from, so I can't be any more specific, but the strings you showed looked like that had a regular pattern indicating blocks of data of some kind. Somewhere in those blocks will probably be the data you want, but you will have to look for it.
If you have any instructions on the device you are talking to, those may help you.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
Hello Sir,
Pls describe me what is wrong with that.
do
{
bytes = s.Receive(buffer);
if (bytes > 0)
{
System.Text.ASCIIEncoding ascii = new ASCIIEncoding();
string url = ascii.GetString(buffer, 0, bytes);
try
{
url = url.Substring(url.IndexOf("GET") + 4, url.IndexOf("HTTP") - (url.IndexOf("GET") + 3) - 1);
Console.WriteLine("http//:" + url);
}
catch { }
}
} while (bytes > 0);
If you can think then I Can.
|
|
|
|
|
Do you want a list?
1) Never use empty catch blocks - they just hide your problems!
2) What if your URL is split across two receive blocks? I.e. if the first s.Recieve fetches 5 bytes, and the second fetches 25?
What is it doing (as if I couldn't guess: "it's not working")?
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
Dear Sir,
Thanks for suggesting a good matter. But still i m waiting for the result oriented answer for that.
Thanks
If you can think then I Can.
|
|
|
|
|
Hi
I've been searching for any real world applications for C# keyword "dynamic"
Example 1 seems pretty lame as "interface" serves a purpose[^]
Example 2 - example don't seems to work, see code below.[^]
<br />
static void Test1()<br />
{<br />
System.Xml.XmlDocument xmlDoc = null;<br />
System.Xml.XmlElement xmlElement = null;<br />
<br />
try<br />
{<br />
xmlDoc = new System.Xml.XmlDocument();<br />
xmlDoc.LoadXml(("<!DOCTYPE root [<!ELEMENT root ANY><!ELEMENT Person ANY><!ELEMENT Customer EMPTY><!ELEMENT Team EMPTY><!ATTLIST Person SSN ID #REQUIRED><!ATTLIST Customer id IDREF #REQUIRED ><!ATTLIST Team members IDREFS #REQUIRED>]><root><Person SSN='A111' Name='Fred'/><Person SSN='A111'/><Person SSN='A222' Name='Tom'/><Customer id='A111'/><Customer id='A222334444'/><Team members='A222334444 A333445555'/></root>"));<br />
xmlElement = xmlDoc.GetElementById("A111");<br />
Console.WriteLine(xmlElement.OuterXml);<br />
<br />
}<br />
catch (Exception Ex)<br />
{<br />
Console.WriteLine(Ex.Message);<br />
}<br />
<br />
return;<br />
}<br />
<br />
static void Test2()<br />
{<br />
dynamic xmlDoc = null;<br />
dynamic xmlElement = null;<br />
<br />
try<br />
{<br />
xmlDoc = new System.Xml.XmlDocument();<br />
xmlDoc.LoadXml(("<!DOCTYPE root [<!ELEMENT root ANY><!ELEMENT Person ANY><!ELEMENT Customer EMPTY><!ELEMENT Team EMPTY><!ATTLIST Person SSN ID #REQUIRED><!ATTLIST Customer id IDREF #REQUIRED ><!ATTLIST Team members IDREFS #REQUIRED>]><root><Person SSN='A111' Name='Fred'/><Person SSN='A111'/><Person SSN='A222' Name='Tom'/><Customer id='A111'/><Customer id='A222334444'/><Team members='A222334444 A333445555'/></root>"));<br />
xmlElement = xmlDoc.A111;
Console.WriteLine(xmlElement.OuterXml);<br />
<br />
}<br />
catch (Exception Ex)<br />
{<br />
Console.WriteLine(Ex.Message);<br />
}<br />
<br />
return;<br />
}<br />
Example 3 - thus far, this seems to be best illustration: The Dynamic Keyword in C# 4.0. It shows how a method called can be done thru (i) Conventional OO interface, (ii) Reflection and (3) dynamic - but still in this example dynamic definitely beats reflection but conventional OO interface is type-safe, dynamic is not.[^]
I still haven't found one example where dynamic is "required" or shows a real promising use.
Anyone? Thanks
dev
|
|
|
|
|
I've used dynamic with COM interop, but like var and this, its a keyword thats often abused by lazy programmers. Reflection should always be your last resort since its super duper slow.
|
|
|
|