|
Hi,
It's my first project in c#. I have to make an app which would export data from xls to my database. It should also validate the data from xls...
I've been working with java and for configuration purposes I've been using spring and xml - then user could change the spring file without again compilation of the apllication...
What do u use in similar projects under c#? Do u have an links?
|
|
|
|
|
haiaw wrote: What do u use in similar projects under c#?
Use application configuration files, which are XML files that contain configuration information for .NET applications. You can add an app.config (or web.config for ASP.NET applications) to your project and then use classes in the System.Configuration namespace to access it.
"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, I've read some articles covering System.Configuration. Now I have simple problem:
I want to have simple list of strings in ArrayList, these r those strings:
aas
bsd
cds
4fe
5
What should I write in app.config? (how u write lists and which handler do u provide for this collection)?
<sectiongroup name="settings">
and then
<settings>
<mylist>
????????????????
and finally in some core file:
ArrayList nvc = (ArrayList)ConfigurationSettings.GetConfig("settings/dbSettings");
MessageBox.Show("Connection String is " + nvc[0].ToString());
I've tried different ways but it doesn't work...
|
|
|
|
|
Dear All,
i have developed a desktop based application using C#.NET.
In this application, i wants to enable & disable the USB drives programatically. ie, enable the USB port before the application starts using it & disable it after the use.
I need to achieve the same when the application is running in a login, who doesn't have administrative rights.
Is it possible to achieve the same using .NET framework?
Do any one knows how to implement this. If so, please inform me.
Best Regards,
Abhilash Chandran
|
|
|
|
|
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
|
|
|
|