|
How can I easy copy a Row from on DataView to another DataView?
Something like:
<br />
<br />
dvUnsortedList = GetDataFromSomeWhere()<br />
DataTable dtSorted = new DataTable("dtSortedList");<br />
dtSorted = dvUnsortedList.Table.Clone();<br />
dvSortedList = new DataView(dtSorted);<br />
.<br />
.<br />
.<br />
if((int)dvUnsortedList[i].Row["lngOwner"] == 0)<br />
{<br />
dvSortedList.Table.Rows.Add(dvUnsortedList[i].Row); <br />
<br />
Thanks
Thomas
-- modified at 8:40 Wednesday 28th September, 2005
|
|
|
|
|
Table.Rows.Add does not copy a row it assigns a row to a table and as you have seen a row can only belong to one table at a time. If you want to copy a row you could use:
<br />
dvSortedList.Table.Rows.Add(dvUnsortedList[i].Row.ItemArray)<br />
Which does make a copy of the data in the row.
|
|
|
|
|
i would like to know the best obfuscator or the most used one.
i need an obfuscator to make harder the job for people who wants to use reverse engineering to read my code.
Thanks
|
|
|
|
|
|
Yes, i agree with you, but i need an answer about the best one. so i posted it again.
tks
|
|
|
|
|
Hi folks,
I am stuck with a problem. I need to read a config file of a windows service. Can any body guide me or give some pointer for this.
thanks in advance.
Rajeev
|
|
|
|
|
Hi all,
I have to do some web scraping from a client's web site as they can't give me a direct feed of data (for various reasons too long and borign to explain here!) so I thought I'd use the WebRequest class which I've used before with success.
However, the data I'm scraping is on pages linked 1 or 2 levels down and they require cookies which WebRequest doesn't seem to handle natively. I added a CookieCollection object to my code but when I call my FetchHTML method (below) for a lower level page (ie: linked from the top page) I just get back HTML containing a message saying that cookies have to be turned on. I think I basically just don't really understand what I'm meant to do with the CookiesColelction between requests so if anyone can look at my method below and tell me where I'm mesing up it would be deeply appreciated!
To recap - it loads the first level page in but any successive pages I get HTML back containing the "cookies are not turned on" message rather than the page I want.
Any help would be great!!
Mike
private string FetchHTMLPage(string strURL)
{
//Create a new UTF8 encoding object
System.Text.UTF8Encoding objUTF8 = new System.Text.UTF8Encoding();
request = (HttpWebRequest)WebRequest.Create(strURL);
request.CookieContainer = new CookieContainer();
response = (HttpWebResponse) request.GetResponse();
response.Cookies = request.CookieContainer.GetCookies(request.RequestUri);
Stream resp = response.GetResponseStream();
System.Text.Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
// Pipe the stream to a stream reader with the required encoding format.
StreamReader sr = new StreamReader( resp , encode );
strHTML = sr.ReadToEnd();
return strHTML;
}
|
|
|
|
|
You have to handle the cookies the same way a browser would. You get cookies in a response, you have to keep them and send them back to the server in the requests.
---
b { font-weight: normal; }
|
|
|
|
|
Well, thanks, but I sorta knew that... that's exactly what I can't get to work so a little more explanation is what I'm looking for.
I've hunted high and low for a working example of this with no luck... if anyone has got this working I'd sure appreciate a glimpse at some working code just to see what I'm missing or have screwed up!
Mike
|
|
|
|
|
Have you tried to take the cookies collection you get in the response, and just put that in the requests that you send?
You might have to keep a cookie collection, and for each response update it with the new cookies you might get.
---
b { font-weight: normal; }
|
|
|
|
|
Hi all,
Does anybody know how to remove the border from around the PropertyGrid control? I've tried overriding OnPaint and doing custom drawing but can't seem to get anything to work...
Any ideas would be appreciated
rob
|
|
|
|
|
I am writing a simple tool that extracts data from an xls and uses it to write an XML file using the XmlTextWriter class. I have a test harness written, problem is I keep getting the following error:
"VS cannot debugging the target as the <projectPath>....exe is missing. Please build the project and retry, or set the OutputPath and AssemblyName properties appropriately to point at the correct location for the target assembly."
I have added the reference "Excel 11.0" so that isn't the problem. I am using a file dialog and have added the "System.Windows.Forms" reference so there is no problem there.
Has anyone ever had this problem beofre when dealing with Excel or XmlTextWriter?
|
|
|
|
|
I've had the same problem before when VSS gets its hands on the executable for the application. I normally end up deleting the contents of ProjectName\Debug\bin and then rebuild the project, seems to sort things out.
On a different note, are you referencing Excel directly or using the Primary Interops (PIA) from Microsoft? I've found c# doesn't like a lot of the methods in Excel if referenced directly, but i don't think it's causing this problem.
HTH
Russ
|
|
|
|
|
I've had the same problem before when VSS gets its hands on the executable for the application. I normally end up deleting the contents of ProjectName\Debug\bin and then rebuild the project, seems to sort things out.
On a different note, are you referencing Excel directly or using the Primary Interops (PIA) from Microsoft? I've found c# doesn't like a lot of the methods in Excel if referenced directly, but i don't think it's causing this problem.
HTH
Russ
|
|
|
|
|
I have the ListBox and UserControl on my form, the problem is: how to scroll ListBox when the UserControl is focused and user rolls the mouse wheel. It seems that the easiest way is to send the message to ListBox that weel was rolled, but how to this. Or maybe there is another way to solve this problem?
|
|
|
|
|
in a project i used richtextbox, i saved richtextbox, but i cannot see images on rrf file. I tried all possibilities.
RichTextBox1.SaveFile("", RichTextBoxStreamType.PlainText)<br />
RichTextBox1.SaveFile("", RichTextBoxStreamType.RichNoOleObjs)<br />
RichTextBox1.SaveFile("", RichTextBoxStreamType.RichText)<br />
RichTextBox1.SaveFile("", RichTextBoxStreamType.TextTextOleObjs)<br />
RichTextBox1.SaveFile("", RichTextBoxStreamType.UnicodePlainText)
I think 4th is true way, but it doesnt working.
And another question, I have to do something to this file so that Word pad cannot open this file, how could i do this. I intend to this file only can be opened by my program.
|
|
|
|
|
Greeky wrote:
I have to do something to this file so that Word pad cannot open this file
If you do that, you're program isn't going to be able to open it either. Since you're using the RichTextBox's methods to load and save files, anything you do to the file to stop WordPad, which is a glorified RichTextBox itself, will stop you from loading the file too.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The shape have a line and a empty triangle that joined the end of the line.
Can you give me some code?Thanks!
|
|
|
|
|
I think you want this:
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
GraphicsPath capPath = new GraphicsPath();
Point[] cappoints = new Point[] { new Point(0, 10), new Point(-10, 0), new Point(10, 0), new Point(0, 10) };
capPath.AddLines(cappoints);
CustomLineCap myCap = new CustomLineCap(null, capPath);
Pen capPen = new Pen(Brushes.Black, 1);
capPen.CustomEndCap = myCap;
capPen.CustomStartCap = myCap;
myCap.StrokeJoin = LineJoin.Round;
myCap.WidthScale = 2;
e.Graphics.DrawLine(capPen, new Point(100, 100), new Point(300, 100));
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,brother.Thanks for your help!:->
|
|
|
|
|
Can you tell me why set cappoints variable like this way.If I changed the array of the points,the line will not anchor the middle point of the bottom line triangle.Because I am a beginner in GDI+,please help me in any case.Thanks a lot!;)
|
|
|
|
|
I am accessing database (Informix) using ADO.NET and not using any transaction, what could be the default transaction status? In this case is system suppose to have dirty read? [ReadUnCommited]
If yes, any idea, what is the difference between using transaction with read Uncommited, or not using transaction.
Are there any performance difference?
Appreciate your help
- ashish
|
|
|
|
|
Hi
I am facing one problem while opening my Dot net project ?Error is coming like there "There is error on 1 Line:Expected '<' but found Auto attach" and the corresponding project file is not a valid project.
if anybody knows please help me out
dimp
|
|
|
|
|
I've never encountered this before but you can try to open the class that is causing the problem with a text editor (recommend CrimsonEditor as it color codes c#, vb, j# etc..) and have a look at the code yourself to try and determine the problem.
Thats the only thing I can suggest.
Sorry I couldn't be more help!
|
|
|
|
|
two projects,BusinessLayer and DataAcessLayer.
DataAcessLayer includes CustomerDB.cs, App.config.
App.config is like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ConncetionString" value="Server Port Address=;Server Name='';Character Set=iso_1;Network Protocol=Winsock;Provider='Sybase.ASEOLEDBProvider.2';User ID=;Password=;Initial Catalog=" />
</appSettings>
</configuration>
CustomerDB class has method GetCustomers
public DataTable GetCustomers()
{
string ConnectionString =
ConfigurationSettings.AppSettings
["ConncetionString"];
............
}
when i call GetCustomers() in BusinessLayer, the ConncetionString is always null.
but i did have a successful try before.
please help me,thanks.
-- modified at 23:06 Tuesday 27th September, 2005
|
|
|
|