|
Hi Luc,
I was able to get this to work. Looking at the debugger again, the system see's the column name with double quotes. I was able to get it to find the record by using this search expression:
DataRow[] rows = dt1.Select("[\"I$PN\"] = 'CA-106-77'");
Notice I changed the name to rows! Now I'm going to spend some time writing some try and catches just in the event there are no rows or multiple rows found.
Thanks for all of your help and input!
"You're damned if you do, and you're damned if you dont" - Bart Simpson
|
|
|
|
|
|
Hi Ennis,
That's the really weird part. I've tried enclosing the column in [], and when I do that the debugger throws the error: "Cannot find column named "CA-" which doesn't make any sense to me. Playing around, the only way I can get it to find the column is wrapping single quotes around it.
"You're damned if you do, and you're damned if you dont" - Bart Simpson
|
|
|
|
|
The link suggests that '-' is a special character and must be escaped.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
If you don't ask questions the answers won't stand in your way.
Most of this sig is for Google, not ego.
|
|
|
|
|
Oh, I thought it said you only needed to do that for the column name. So it should look like this? [I$PN] = 'CA\-106\-77' ?
update. Ah, I got it working. I used the debugger and looked at the table again. The table see's the column header with double quotes in it. I was able to get it to work by using this.
DataRow[] rows = dt1.Select("[\"I$PN\"] = 'CA-106-77'");
Thank you for your help!
"You're damned if you do, and you're damned if you dont" - Bart Simpson
modified on Monday, February 9, 2009 8:59 AM
|
|
|
|
|
First: What Is a User-Control Embedded Class?
A User-Control Embedded Class is a user-control with no U.I. but has a separate class (such as public class MyEmbeddedClass() { }) located just below the user-control's partial class, and the class is just like any other class, having properties, private and static methods (mostly static), etc., such that when the user-control is placed on a web page, only that webpage wherein the user-control is placed on can now call MyEmbeddedClass() methods.
And, in a web app that compiles on the fly, only that web page is impacted when MyEmbeddedClass (located in the user-class'es code-behind) is changed.
Usage:
Create a user control called classMyStuffcontrol.ascx, then add a SEPARATE class to it as follows
public class MyStuff(){
}
We'll pretend it is a decent sized class, having 12 or so static methods (functions), around 500 lines of code.
Focus #1: Now, this user control is needed on about 7 web pages and 3 other user controls.
1) Does this mean, in Focus #1, that there would be 10 instances of the class Mystuff (within classMyStuffcontrol.ascx), even though there are only static methods?
Focus #2: Now, one of those pages which already uses one of the user controls that has MyStuff() in use also needs access to the class MyStuff, so I add the MyStuffControl to the web page as well..
2) Does this mean that there are multiple instances of the class MyStuff for that webpage and user-control, both using classMyStuffcontrol.ascx, would there be 2 instances of the class MyStuff instantiated even though there are only static methods?
Now, before ya start asking "why", here's why I do this:
- some 3 years ago I was asked to create a single user control that did tons of stuff; no extra code files would be accepted. So I coded the whole thing in a single UI page and corresponding code-behind page (those 2 files were acceptable). The code behind had 6 separate classes which focused on a given set of tasks.
Soon after this, a different client asked for the same thing once they became aware that I had done something like this already. From there, it kept snowballing; client after client wanted similar output (1 or 2 files containing all the code for a big solution.
After 6 months, I set aside this 'practice', but a few months later started using it wherein only a single class was associated to a single user-control. Now, there are still the universal / web-app-wide classes I used, but alot of the other classes were specific to a given area, and/or not used as much as a webapp-wide class would be used.
What this permitted was my ability to change the user-control embedded class, affecting only those web pages (wherein an on-the-fly compile took care of it) versus a web-app restart (such as what occurs when the web.config file is changed).
Have I described this enough such that you would be able to provide feedback as to its usefulness and/or practicality? Specifically, am I asking for trouble down the line or are user-control embedded classes, when used in moderation, a reasonable solution?
Thx.
ASPX ~ Apple Simply Performs eXcellently
|
|
|
|
|
Gary - if I were you, I'd ask this question in the General IT forum or the .NET forum. The problem with posting here is that this is a high traffic forum, so your post will soon get swamped. As it is, the post is worthy of more consideration so I would definitely consider moving it.
|
|
|
|
|
Well, after posting it 2 other times to other .Net forums on CodeProject, and multiple times on other sites, yours is the *only* reply I've received. So, if "this post is [really] worthy of more consideration", you and I seem to be the only ones who conclude such.
http://www.codeproject.com/script/Forums/View.aspx?fid=12076&msg=2888591[^]
ASPX ~ Apple Simply Performs eXcellently
|
|
|
|
|
I've used xsd.exe to great effect in the past to generate classes from xsds, but what I'd like to do now is do the same thing at runtime. The idea is to provide a plugin-type architecture where xsds can be dumped into a certain location and on its next run my application will pick them up, generate code from them and add that code to itself. I can't go into specifics too much, but I can give a more general example:
Imagine an app that by default only knows how to handle certain xml files. What I want to do is essentially provide that application with the ability to understand other document types by giving it a definition (xsd) of what those types look like. From the definition the app will be able to generate classes from which it can instantiate objects of the document's type. Assuming the generated class conforms to an interface (which it will) generic code can then be written to use any document type without knowing anything about that type in advance.
I'm not too concerned about the more theoretical bits here, I'll try that myself and see if it works as I think it should, but if anyone has any examples of how a class can be created from an xsd, so I can perpetrate this madness I'd be grateful.
|
|
|
|
|
Just use a DOM parser. It will save time.
If you really, really, really want to try this approach, spawn a process, run xsd.exe with valid options on the file, run csc.exe on the .cs file created, use and Assembly.LoadFile to load the assembly.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
If you don't ask questions the answers won't stand in your way.
Most of this sig is for Google, not ego.
|
|
|
|
|
Hi
I want to read the caption(title) of another window in C#. Is it possible? If it is how can I do it?
Thanks.
|
|
|
|
|
Use P/Invoke. Get the hWnd of a window through one method or another, then call SetWindowText, passing the new title and hWnd as parameters
|
|
|
|
|
|
Hi folks,
i´m trying to get a SelectedListViewItemCollection threadsafe, because i´m using it in a method which is called from another thread (FileSystemWatcher_Created).
I have tried to get the collection using a delegate function, but it won´t work fine.
Here is the code:
private void FuelleUnitsAuto()
{
Invoke(new clearListViewDelegate(BeginUpdateListView), new object[] { lV_Einheiten });
Invoke(new beginUpdateListViewDelegate(ClearListView), new object[] { lV_Einheiten });
ListView.SelectedListViewItemCollection coll = (ListView.SelectedListViewItemCollection)Invoke (new selectedListViewItemsDelegate(SelectedListViewItems), new object[] { lV_Num });
foreach (cEinsatzListViewItem i in coll)
{
}
Invoke(new endUpdateListViewDelegate(EndUpdateListView), new object[] { lV_Einheiten });
}
private delegate ListView.SelectedListViewItemCollection selectedListViewItemsDelegate(ListView view);
private ListView.SelectedListViewItemCollection SelectedListViewItems(ListView view)
{
return view.SelectedItems;
}
Anyone knows this error and can help?
Thanks a lot in advance,
Tobe
modified on Friday, February 6, 2009 10:22 AM
|
|
|
|
|
Does someone know this problem?
|
|
|
|
|
My project is a windows application. After i install the setup file of this project. I am getting the first form, i need to select from four options i,e. four buttons. When i press a button, next form is displayed asking for username and password. After giving username and password, when i press login button then i am getting that exception. If i run normally in visual studio 2005 , it is executing
|
|
|
|
|
|
even thou in the past i post a link to an old post, you have to feel sorry for people who dont have a clue. They try programming before even knowing how to learn, or search on the interent.
I think it would be good if unanswered posts where auto reposted in some fashion every so often for a period of time, because im sure most people only answer recent post and unless someone who can help is online when you put the post, the chances are they wont see your question after a few hours have passed.
Anyway, dont want to stick up for the people who rely solely on asking for answers to much lol
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
Hi,
I have a datagridview control that has the datasource attribute set to my binding source bndSrc . Two buttons with the below code are filling the datagrid successfully with the datatable data whenever clicked but the problem is I still get columns from the previous table that I just cant get rid of by clearing the binding source, the dataset or by refreshing the datagrid or resetting it's datasource!
Please help guys.
private void button1_Click(object sender, EventArgs e)
{
FistTableAdapter.Fill(dataSet1.Table1);
bndSrc.DataSource = dataSet1.Table1;
}
private void button2_Click(object sender, EventArgs e)
{
SecondTableAdapter.Fill(dataSet1.Table2);
bndSrc.DataSource = dataSet1.Table2;
}
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Aren't you filling the datagridview before binding it to the table you want?
I'm still pretty green, but I've done something like this and I bound the dataGridView to the desired tableBindingSource before issuing a fill statement and that worked fine for me.
dataGridView1.DataSource = tableBindingSource;
|
|
|
|
|
You should be able to just go dataGridViewControlName.Columns.Clear before you change your datasource
|
|
|
|
|
Thanks mate! I think it's working now but I still cant see any change!!
I know my problem though, it's just refreshing the datagrid which I still cant do it!!
I know my datatable is loaded using the binding navigator and seeing how much rows I have for each table when there's nothing but a dark gray background on my datagrid!!
Please tell me how to refresh this bloody control refresh() or even reassigning the datasource didnt help.
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
|
|
hi
When i was run that code i cannot received the marker in particular position in web page.
But when i was save that map via the coding ,at that time i can able to see the marker in particular lat and long position only in image format .but in webpage(aspx) a cannot be received the marker's position ..
plz guide me
This is my code snippet
protected void Button2_Click()
{
double Lat_max = 48.11576;
double Long_max = 29.17936;
mapObj map = new mapObj("1.map");
layerObj layer = new layerObj(map);
layer.name = "School";
layer.type = MS_LAYER_TYPE.MS_LAYER_POINT;
layer.status = mapscript.MS_ON;
classObj clsobj = new classObj(layer);
styleObj styobj = new styleObj(clsobj);
styobj.symbol = map.getSymbolByName("marker");
pointObj poiobj = new pointObj(0,0, 0, 0);
poiobj.setXY(Lat_max, Long_max, 0);
lineObj line = new lineObj();
line.add(poiobj);
shapeObj shp = new shapeObj ((int) MS_SHAPE_TYPE.MS_SHAPE_POINT);
shp.add(line);
layer.addFeature(shp);
imageObj img = map.draw();
}
Thanks in advance
Raju
|
|
|
|
|