|
I supose you have a datatable... I believe that only way to collect all column data is doing a loop for all rows and getting column value...
private string[] GetAllColumnValues(DataTable dt)<br />
{<br />
List<string> aValues = new List<string>;<br />
foreach(DataRow oRow in dt.Rows)<br />
{<br />
aValues.Add(oRow["colName or index"].toString());<br />
}<br />
return aValues.toArray();<br />
}<br />
Visit my blog at http://dotnetforeveryone.blogspot.com/
|
|
|
|
|
|
hi all,
I m striving from couple of days to implement a list in my project similer to the Undo list in Visual Studio and MS Outlook.I m not able to do it yet.
So , please if anyone knows how to do it and have ever done it , please tell me.
I will be so thankfull of u .
Thanx.
Praveen Sharma
|
|
|
|
|
|
Hi all ,
We are creating an application in which we need to load an XML file , located in a seperate folder named "Resources" , where this folder is exist in the solution file.Following is the code snippet, in which im trying to load the xml file in the Stream object:
Ln1 Assembly assembly = Assembly.GetExecutingAssembly();
Ln2 string resourceName = String.Concat(typeof(WebForm1).Namespace,".Resources.","Features.xml");
Ln3 Stream objStream = typeof(WebForm1).Assembly.GetManifestResourceStream(resourceName );
Ln4 StreamReader objStreamReader = new StreamReader(objStream);
Ln5 XmlTextReader xtr = new XmlTextReader(objStreamReader);
Ln6 return xtr;
Here the string resourceName we are getting is "Utility_XML.Resources.Features.xml"
where
Utility_XML -->Name space
Resources --> Folder
After LineNo3 the value populated in the 'objStream' is "Undefined Value". so struck up in this stage. I really appreciate if some one could guide me to fix this issue.Thanks in advance!
Best Regards,
Krishna Chandran
|
|
|
|
|
Could any body please help how to develope an internet diler application in.net nd what are the requirements to run this dialer on Win9x ,XP nd windows server systems.Through this i have to display total MBs consumed and receving nd sending bytes info.I am completely new to this work.
Any help will be greatly appreciated.
Thanks
|
|
|
|
|
|
thank you abhijit for ur earliest response.I will go thorugh it.
|
|
|
|
|
thanks, and if u will get any another solu~n let me know
Happy Programming
-----
Abhijit
|
|
|
|
|
Hello,
I am having one private field which is encapsulated in public property.
As i can modify the field using the variable itself with in the class and through property outside the class.
Here the question is how should i modify the field....????
1)Through the property always, within the class or outside the class.
OR
2)Field within the class and use property outside the class.
I am agree with the 1st point because it increase the developers readabilty and easy to maintain.
Other side is the performance.. If i directly modify the variable, i am reducing one call which might give better efficiency.
So what is the better way???
|
|
|
|
|
What if u have million and million of code
at run time when u want to set/get value from inside u'll pass THRU the Property
(why go THRU a baypass) where u can go directly.
inside the class use the private field THUS escaping the :
get { return myVale };
this is a code line u escape in run time
the return itslef has it's own code like (go to the value ....)
kobkob
|
|
|
|
|
If you want to access the internal value, use the variable. If you want to access the value as it would be accessed outside the class, use the property.
gajesh wrote: If i directly modify the variable, i am reducing one call which might give better efficiency.
If the code for the property is simple, it will be inlined where you use it, and optimised down to just accessing the internal variable. So in most cases there is no difference in performance between using the property and using the variable.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
HI,
i'm looking for some sort of template that goes like this :
when my app start's :
private void Form1_Load(object sender, EventArgs e)
{
1.load data from "dData.mdb" (using odbc)
2. store data in some sort of a Collection (DataSet, ArrayList...
what ever it does not make any diff)
}
That's all (i know it's not simple)
if any one can give me alink, maybe a pdf toturial, etc..
THNKS in advance
kobkob, Have A Wonderfull Day
|
|
|
|
|
|
first THNKS
but, can i escape the : DbCommand.CommandText = "SELECT * FROM NATION"; ?
i want it load each and every table from the db
kobkob
|
|
|
|
|
using CommandText you have to speccify the command that you want to execute.
If u dont want to use CommadText , then while creating command you have to pass the query as argument
e.g
Sqlcommand cmd=new Sqlcommand(yourQstring,connection)
and if you want to read all table at time, u can use join operation
like select * from nation,state where nation.id=state.id
[ asume those id are equal]
Happy Programming
-----
Abhijit
|
|
|
|
|
what i ment was that i have like 50 tables, O.K?
and i want them all using a for or foreach.
and automaticlly store them to a dataSet or any kind of Object i've created.
kobkob
|
|
|
|
|
Then try to read the all table name and pass as argument to the query
e.g
string s= select * from + tablename ;
dbcommand.Text=s;
create a object of database and read the table !!!!
Happy Programming
-----
Abhijit
|
|
|
|
|
hey,
check ur latest post in this forum and let me know when done !!!!!
Happy Programming
-----
Abhijit
|
|
|
|
|
any reason why you use ODBC and not OleDb?
V.
No hurries, no worries
|
|
|
|
|
Yes
What if i move the file?
the string of the path is not valid any more.
ODBC is a driver it knows "where" the file is.
kobkob
|
|
|
|
|
Why would you 'move' the file?
And besides, I could be wrong on this one, I never work with ODBC if I can avoid it, don't you need to add the database in the ODBC datasources of windows? In fact, your DSN is nothing more then a name corresponding to a path.
kobibi wrote: ODBC is a driver
And what is OleDb you think? A fluffy bunny rabbit ?? (lol, it was joke ), seriously OleDb is much faster then ODBC.
Note: There is nothing wrong with ODBC..., it's just old
|
|
|
|
|
O.K
So if i'll use the OleDb how can i get all of my tables from ".mdb"?
and the important thing is maybe some IDIOT will move the file
how can i handle that?
kobkob
|
|
|
|
|
Same principle as ODBC, you need a connection string:
This[^] might be helpful?
You can check if the file exists, I think with the File or FileObject classes, which has a property or method FileExists...
good luck.
|
|
|
|
|
and another Q
if i'm using the bindingSource
will it the do the work for me???
kobkob
|
|
|
|