|
Hi,
How to perform delete with datagridview.Please provide me code for this delete operation.
Thanks in advance.
|
|
|
|
|
Hi All,
need suggestion and help!
which would be the best opion for passing a vlue for criteria (in where clause) to sql server database:
using member property or
using parameters or
by any other technique?
With Thanx.
-- modified at 4:35 Saturday 27th May, 2006
|
|
|
|
|
uroojkhanpk wrote: using member property
I don't know what you mean by that.
uroojkhanpk wrote: using parameters
Yes, parameters are a good way. They reduce the attack surface of your application which reduces the chances of being susceptible to a SQL Injection Attack.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Thanks Colin Angus Mackay!
property member means:
private int variablename;<br />
public int VariableName <br />
{<br />
get { return variablename; }<br />
set { variablename = value; }<br />
}<br />
string qry = "Select abc From table Where xyz = " + this.VariableName;
is it clear know?
Thanks again.
-- modified at 5:26 Saturday 27th May, 2006
|
|
|
|
|
uroojkhanpk wrote: string qry = "Select abc From table Where xyz = " + this.variablename
Never ever do that for two reasons:
1. It makes your code susceptable to a SQL injection attack.
2. You cannot concatenate an int onto a string .
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
that was a simple demo. while in real conversions are made.
Thanks for suggestions.
|
|
|
|
|
Where the values come from when you construct the query is quite irrelevant. It's just another non-parameterized query.
A parameterized query is generally preferred.
---
b { font-weight: normal; }
|
|
|
|
|
Hello,
Is not there any method available to make an Array with only Unique elements in C# ? after calling the method, the Array must get rid of all duplicate elements.
Thanks
Emran
|
|
|
|
|
|
Have a look at the free PowerCollections library.
http://www.wintellect.com/[^]
You have to register to access it but registration is free and you won't get spammed!
Oh, I'm assuming you're using .NET 2.0?
Kevin
|
|
|
|
|
Hi Kevin.
Yes, I am using .NET 2.0 C# Express. Wont the code snippet work for .NET 2.0 ?
Emran
|
|
|
|
|
OK, I've found an example I wrote a while back using the PowerCollections library.
<code>
int[] source = { 1, 4, 4, 6, 1, 2, 2, 3, 1, 6, 6, 6, 5, 7, 5, 4, 4 };
List<int> list = new List<int>(source);
list.Sort();
Algorithms.RemoveDuplicatesInPlace(list);
foreach (int var in list)
{
Console.WriteLine(var);
}
</code>
Kevin
|
|
|
|
|
Hello Kevin,.
Thanks for your reply. Ok, would this remove duplicate with case insensitive or case sensitive. ?
Emran
|
|
|
|
|
I'm away from my development PC for a couple of days. But generally these methods allow you to define a function (called a "predicate" in this context) which allows you to define the criterion for a match. Just download that library and investigate. It comes with a sample solution which demonstrates most or all of the algorithms.
And re: your other reply, PowerCollections works with .NET 2.0 only, so it should work for you. There's no installation program. You just unzip the download and add a reference to the DLL. But, as I said, you do have to register at the Wintellect site (for free) to get it. When it just came out, anyone could access it.
I don't know whether you've done any C++, but PowerCollections is similar in philosophy, and has similar algorithms, to the STL.
Kevin
|
|
|
|
|
I tried to encode 1252 or 1256 codepage to 864 codepage but always display "??????????"
I need solution for this problem.
Abu shanab
|
|
|
|
|
How did you try?
Does the 864 codepage have the characters that are in the text?
---
b { font-weight: normal; }
|
|
|
|
|
I used the encoding class to encode the codepages
Encoding LATIN = Encoding.GetEncoding(1256);
Encoding OEMIBM=encodingg.getEncoding(864);
and i used the function Convert to do this process.
|
|
|
|
|
Then we return to my second question:
Does the 864 codepage have the characters that are in the text?
And this new one:
How do you display the data?
---
b { font-weight: normal; }
|
|
|
|
|
yes have the characters that are in the text,and i display data on the messagebox to show what's happen.
do u have any idea?
|
|
|
|
|
How do you decode the data before you show it in the message box?
---
b { font-weight: normal; }
|
|
|
|
|
I Decoded in same way i enocde these codepages
|
|
|
|
|
And how do you do that?
---
b { font-weight: normal; }
|
|
|
|
|
public string Display(string Str)
{
string UnicodeStr;
Encoding encGet3270Bytes;
Encoding UnicodeEnc = Encoding.Unicode;
Encoding ANSIArabic = Encoding.GetEncoding(1256);
Encoding Latin1 = Encoding.GetEncoding(1252);
Encoding OEMArabic = Encoding.GetEncoding(864);
#if CODEPAGE_1256
encGet3270Bytes = ANSIArabic;
#elif CODEPAGE_1252
encGet3270Bytes = Latin1;
#endif
byte[] cp864bytes = encGet3270Bytes.GetBytes(Str);
byte[] UnicodeBytes = Encoding.Convert(OEMArabic, UnicodeEnc, cp864bytes);
char[] UnicodeChars = new char[UnicodeEnc.GetCharCount(UnicodeBytes, 0, UnicodeBytes.Length)];
UnicodeEnc.GetChars(UnicodeBytes, 0, UnicodeBytes.Length, UnicodeChars, 0);
UnicodeStr = new string(UnicodeChars);
return UnicodeStr;
}
|
|
|
|
|
The code looks ok. You encode a string using 1256 or 1252 codepage, then decode it back to unicode. The only way I see that this would fail, is that the codepage does not support the characters in the string.
What characters is it that you have problem encoding?
---
b { font-weight: normal; }
|
|
|
|
|
I need To encode and decode arabic characters, do you have any suggestions?
|
|
|
|