|
I implemented the paint method by Jay_sh_s, but im confused.
In my DataSet i have many Tables, so:
For each tables i ll have to create 1 DataGridTableStyle?
and the ColumnStyles, for each table to?
Thanks.
|
|
|
|
|
|
Hello to all,
I have an Access table with several rows in it and a boolean field (column) that only has one row (record) that is TRUE.
Using C# how do I programmatically determine the row that is TRUE and get the index of that row?
So far I am at:
foreach (DataRow row in ds.Tables["currlist"].Rows
I would assume this will go through each row and then find the row that is TRUE in the boolean field. If there is a different, better way please point me in the right direction.
Thanks,
BIll Antonacchio
|
|
|
|
|
Using a DataColumn might be quicker since you are searching for a particular value for only one attribute of the table, not sure though.
|
|
|
|
|
Try
ds.Tables["currlist"].Select("whatyourfieldiscalled='true'");
Will return a DataRow, a much nicer way than using a linear search.
Ryan
|
|
|
|
|
Hi Ryan,
Thank you kindly for that. Will try to get this to give me the info needed. I need to rethink the question though. Will this give me the row number that contains the TRUE field?
What I need to get is the index number of the row that contains the TRUE field.
Regards,
Bill Antonacchio
|
|
|
|
|
** same answer **
Grim (aka Toby) MCDBA, MCSD, MCP+SB
|
|
|
|
|
I am currently developing an asp.net application that develops crystal reports using the push method. What I am wondering is if I can allow the user to specify sort options during runtime while they are viewing the report information in the .asxp page? For instance I have a report that displays three bits of information about a part(PartNumber,RevisionNumber,CallNumber). I am wondering if I can allow the user to switch between sorting the records by these given fields and just have the page reload with the same data in the newly selected sorted order. Thanks in advance for any help
Frank Lepkowski
PS Sorry if this is not posted where it should be I was not sure were to stick the post!
|
|
|
|
|
<code>
DataSet datas = new DataSet("DataSetName");
DataTable dataTable = new DataTable("myNewTableName");
DataRow dataRow = dataTable.NewRow();
dataTable.Rows.Add(dataRow);
for(int i = 0; i<5; i++)
{
DataColumn dataColumn = new DataColumn();;
dataColumn.ColumnName = "myColumnName"+i.ToString();
dataTable.Columns.Add(dataColumn);
dataRow["myColumnName"+i.ToString()]="myItem"+i.ToString();
}
dataTable.AcceptChanges();
datas.Tables.Add(dataTable);
dataGrid1.DataSource=dataTable;
datas.WriteXml("TestXml.xml");
</code>
This code generate the following xml file:
--------------
<?xml version="1.0" standalone="yes" ?>
<DataSetName>
<myNewTableName>
<myColumnName0>myItem0</myColumnName0>
<myColumnName1>myItem1</myColumnName1>
<myColumnName2>myItem2</myColumnName2>
<myColumnName3>myItem3</myColumnName3>
<myColumnName4>myItem4</myColumnName4>
</myNewTableName>
</DataSetName>
--------------
I need the same data to be formatted in this way:
--------------
<?xml version="1.0" standalone="yes" ?>
<myNewTableName myColumnName0="myItem0" myColumnName1="myItem1" myColumnName2="myItem2" myColumnName3="myItem3" myColumnName4="myItem4"</myNewTableName>
--------------
how can I do this?
thanks
_____________
http://members.xoom.virgilio.it/yuppygames/english/index.htm
|
|
|
|
|
Don't use a DataSet . It outputs XML in specific ways - namely as elements. Instead, see the classes in the System.Xml namespace. You could enumerate the tables and columns in your DataSet (or use an XmlDataDocument ) and then write them out to a file using an XmlTextWriter , which allows you to write attributes, elements, comments, and even processing instructions however you want. Lots of samples are included in the class documentation for the System.Xml namespace.
One other option is to save this to a file or a MemoryStream and then load it into an XmlDocument or some other class. You could then use a XslTransform to transform the elements into attributes.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Gurus,
I would like to know how I can handle multiple modems and force applications that have web access to use a modem or another?
For instance, I have 2 digital modems (one cable and one ADSL) and I would like some applications to use the cable modem and other applications to use the other modem.
At the end of the application I would like to build I could handle a list of applications/dlls that could use a given modem.
For example:
Internet Explorer uses Modem 1 and Modem 2
eMule uses Modem 1 only
Messenger uses Modem 2 only
etc.
Is it possible to build such application with C#? Maybe such a tool already exist?
Best regards to all.
There is no spoon.
|
|
|
|
|
Most applications aren't sensitive to particular connection devices. I know that IE and Messenger are not.
About the only way to acheive this is to - after connecting - modify the route table so that connections to certain hosts go through a particular gateway. For modems, you must connect first before doing this because most ISPs hand-out dynamic IP addresses (even many broadband providers). Some will grant you a static IP, but often times charge extra. So, until you know what your dynamically assigned IP address is, you can't modify your route table accordingly.
As far as using C# to do this, why? Modify a route table is low level, although you can do it using the route.exe command-line utility. Managed applications aren't the solution to everything, especially low-level APIs. For instance, you'll probably never see managed code used for device drivers. These drivers are typically written in C and sometimes even assembler, or at least in part.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Heath,
I am looking for a way to create an application that matches an application for a give set of modems.
I currently have 2 modems with static IPs and all I can do is to bridge the modem so the result is that the resource networks are in common like if I had a dual CPU. It does not download faster, but while I do massiv downloads, I can still continue to navigate smoothly
I was wondering if it is possible to do an application that can do what I just mentionned that is assigne a set of modems to a given application and for the application to use the set of modems.
I think it's possible or maybe there are tools that already exist.
I just wanted to write this in C#, just for the fun of code. As suggested "leppie", I can build the low level in C/C++ and interface in C#. But first of all, does such an application exist??? I was thinking of ISA or any other firewall, but it's not really the purpose of fire walls...
I'm looking for such application for a while, and I was wondering to do it my self or not :
There is no spoon.
|
|
|
|
|
Again, this works through route tables. If you don't know what a route table is, it's what routes requests to a given host through the proper gateway. Firewalls use a similar concept, only they use stateful filtering because they can - they are completely between you and your request host. You can't preempt the Windows TCP/IP stack like this. That leaves you with one option: route tables.
When you connect with multiple devices (say, two modems) each will have a different IP address. This will be your local gateway. You could modify your route table so that all requests to www.codeproject.com (209.171.52.99) go through one modem while all others are routed to the other.
This has absolutely nothing to do with the name of the application, which most often simply uses the networking APIs of the operating system.
Don't believe me? Try reading the TCP/IP specifications and check back in a few days when you're finished reading them.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
So, an application can't be forced to use a modem or another? Then what about bridged networks???
There is no spoon.
|
|
|
|
|
Again - route tables. Take a VPN connection. When I VPN from home to the office, my route table is modified such that all connections not to my home network are routed through the VPN connection. Seriously - try reading about the subject. If you don't even understand a route table, how do you expect to even do this?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
ok,
lets start with the begining, where can I get these informations? in the MSDN?
There is no spoon.
|
|
|
|
|
Some, yes. Others are in RFCs. Hell, ask any decent systems administrator and they'll tell you the same thing.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
we don't have any where I work!!!
The tool I wanna do is non professional purposes, just for my brain stimulations
There is no spoon.
|
|
|
|
|
And you've never heard of newsgroups and other forums besides those here on CodeProject?
Seriously, try reading-up on TCP/IP. I've been doing this for a very long time and speak from experience and knowledge gained by reading and participating in newsgroups and mail lists.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'm going to read some articles on the MSDN...
I've just discovered newsgroups last week
I usually use codeproject and the other one I won't name here
I've been trained for local programming while doing my MCSD trainings, I never heard about Sockets and TCP/IP...
I only had theory 7 years ago about OSI and so on... it was blah blah blah... nothing concreete...
I'm looking on the MSDN for additional information. I guess there is enough for what I need to do.
There is no spoon.
|
|
|
|
|
bouli wrote:
I never heard about Sockets and TCP/IP...
The very thing that makes the entire Internet and other networks possible? And you're studying for an MCSD?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I finsihed two years ago... lol it was only about Visual C++ and MSF (Microsoft Solution Framework, a kind of accelerated Merise conception of software).
When I said never heard about Socket and TCP/IP, it was not the purposes of the trainings. Even in COM/DCOM/COM+ programming trainings, we never used sockets because it was not needed.
As you know, I just started to use sockets with C#
I have to go now...
We'll talk tomorrow.
See ya!
There is no spoon.
|
|
|
|
|
bouli wrote:
I've just discovered newsgroups last week
I've been trained for local programming while doing my MCSD trainings, I never heard about Sockets and TCP/IP...
Nothing like biting off WAY more than you can chew!
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I don't know of an application that will do this either. Simply because applications don't give a damn which network their on. It's just not in an applications domain to care which devices carries its communications. Remember the OSI model? It's there for a reason and applications sit at the top of it, not down near the Network layer.
Like Heath said, about the only thing you can do is modify the route table based on the destination IP's that your apps are trying to connecting to.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|