|
Do C# database classes have anything like the old ADO had:
while(!pDs->EOF())
{
/////
pDs->MoveNext();
}
I have noticed that we have tables, rows, andcolumns, but i am
curious as to how maintain a dataset between pages in a case
such as a multipage search engine?
|
|
|
|
|
If you use a SqlDataReader , this may help:
SqlDataReader r = cmd.ExecuteReader();
while(r.Read())
{
}
As far as part 2, you could use a page Cache of the dataset, and a Repeater control you modify to do the "pagination" The Microsoft .NET Pet Shop 2.0[^] has an example of one of those to paginate data.
-- ian
|
|
|
|
|
You could also do that with OleDbConnection like this:
OleDbDataReader myReader = myCom.ExecuteReader();
while(myReader.Read()){
// do your thing here with myReader
}
Børge Warvik
|
|
|
|
|
please see this code i want to start a process.After successful
starting i want to get its id for further processing.For that
purpose most of my processes are setup files (of some software like installers)
most of the processes execute this code successfuly but when i start
a process for example setup file of yahoo messanger installer or VCD Cutter installer
and some other software they all raise an exception(InvalidOperationException)
at last line although the process started successfully and its window appears
,and started process has its existance.
i want to get its id only(in last line of this code ).
my question is
why it raise an exception although started process has its existance?
i think its id is changed.am i right ?
if yes how to trace it id?
or it might be possible that the main process i start also start some other process and
exit itself. if thats true how to trace these processes?
int idpro;
tmpProcess = new Process();
tmpProcess.Exited += new EventHandler(this.ProcessExited);
tmpProcess.EnableRaisingEvents=true;
tmpProcess.StartInfo.FileName=strProcName;
try
{
tmpProcess.Start();
while(! tmpProcess.Responding)System.Windows.Forms.Application.DoEvents();
}
catch
{
}
idpro=tmpProcess.Id;
r00d0034@yahoo.com
|
|
|
|
|
Your process needs to have a main window handle for .Responding to work well. (.Responding will send it a timeout message and expects an answer).
I guess you may avoid any exception raise if you would do that instead :
if (tmpProcess!=null && tmpProcess.MainWindowHandle!=IntPtr.Zero) idpro = tmpProcess.Id;
PS : .Responding does not work on W9X systems under certain circumstances, as said in the doc.
Back to real work : D-27.
|
|
|
|
|
first of let me tell you i am using xp.
GOOD CHECK but that check avoid me to get id of an existing window like yahoo messanger because its window exist after calling start but its id dont.
is it possible that tmpProcess is not null and its id also dont exist.
please tell a little bit about this check
tmpProcess.MainWindowHandle!=IntPtr.Zero
what that IntPtr.Zero is?
r00d0034@yahoo.com
|
|
|
|
|
imran_rafique wrote:
GOOD CHECK but that check avoid me to get id of an existing window like yahoo messanger because its window exist after calling start but its id dont.
is it possible that tmpProcess is not null and its id also dont exist.
I don't like the way the .NET Process class gets a process ID, it assumes several things internally, and depending on the process, they may well be wrong.
I would definitely use interop to get that process ID, it should not be that hard.
imran_rafique wrote:
tmpProcess.MainWindowHandle!=IntPtr.Zero
that's aimed to check if the mainwindowhandle is not null. IntPtr has an enum inside, IntPtr.Zero is one of the values of that enum.
Back to real work : D-27.
|
|
|
|
|
whats interop?
r00d0034@yahoo.com
|
|
|
|
|
[DllImport("kernel32", CharSet=CharSet.Auto)]
static public extern int GetCurrentProcessId();
Back to real work : D-26.
|
|
|
|
|
Hi, I am playing with the HttpRequest class to try to make something work. I found that it appears, everytime you user the GetResponse() from the WebRequest, you have to initialize the object again, to get proper response in the pages that are authenticated. Is this normal, should it be like this?
WebRequest request = (HttpWebRequest) WebRequest.Create(URI);
/... do the network credentials here
request.GetResponse();
/... do something else
//this line has to be here to use GetResponse() again.
request = (HttpWebRequest) WebRequest.Create(URI);
/....
request.GetResponse();
K.D.
|
|
|
|
|
Hey kavehdr,
YOu may feel free to check out http://www.aspalliance.com. It has some beautiful code in HttpRequest and a wrapper for FtpWebRequest too.
Perhaps that should help you in your queries.
I think Google Search of
aspalliance httpwebrequest
should bring you the pages that you are looking for. Sorry that, I do not remember the exact URL looking for at AspAlliance. But the abovespecified search pattern lands up in AspAlliance site first.
deepak
Deepak Kumar Vasudevan
http://deepak.portland.co.uk/
|
|
|
|
|
Hi, is it possible to write assembly inside C# code; similiar to what we were able to do in borland c++, using the asm keyword
Thanks
K.D.
|
|
|
|
|
No, but you can use pointers and some other "low-level" operations with the "unsafe" keyword
lazy isn't my middle name.. its my first.. people just keep calling me Mel cause that's what they put on my drivers license. - Mel Feik
|
|
|
|
|
So there is basically no way to open EXE files and read and write to them at binary level?
K.D.
|
|
|
|
|
Reading and writing to files of any format can certainly be in C#. I'm not sure how that relates to using assembly instructions from inside C#, though.
John
|
|
|
|
|
You trying to patch .exes?
If you really want to use .NET and assembly, use c++ 7 and __asm , but you'll need to do extra stuff if its within Managed Code.
"The greatest danger to humanity is humanity without an open mind." - Ian Mariano
http://www.ian-space.com/
|
|
|
|
|
Yeah kinda. Things like changing the exe header...etc.
No way to do in c#?
K.D.
|
|
|
|
|
Maybe I'm showing my ignorance, but what special need is there for __asm when all you're doing is changing the contents of a file?
C# provides easy file access, just check the System.IO.FileStream and other classes within the System.IO namespace.
If you are trying to do more complicated things than merely reading and writing to the file (like trying to monkey with an already executing program), then you can try using the System.Runtime.Interop namespace to access most/all of the Windows APIs. If you still can't get there, then you can create a C++ dll to do the specific work you need, and call that from C#.
John
|
|
|
|
|
John is right. If all you are doing is modifying the file, there's no need for __asm , and C# supports binary file ops.
|
|
|
|
|
Can anyone figure out why the following code always throws an exception from the site, that the password is incorrect(401) even though when it is correct!
using System;
using System.Net;
class website
{
public static void Main(string[] args)
{
if (args.Length != 3)
{
Console.WriteLine("usage: p25 \"URL\" \"username\" \"password\"");
return;
}
WebRequest request;
WebResponse response;
try{request = WebRequest.Create(args[0]);}
catch
{
Console.WriteLine("The Url provided is not a valid Url");
return;
}
request.Credentials = new NetworkCredential(args[1], args[2]);
try{response = request.GetResponse();}
catch(WebException e)
{
Console.WriteLine("The following error occured while accessing the resources:\n"
+ e.Message);
return;
}
}
}
K.D.
|
|
|
|
|
|
Hi all.
I'm developing a class that inherits from System.ComponentModel.Component in much the same way as Timer etc.
What I need to know is "How do I get a reference to the parent Form?"
I need this so I can add a event handler for the forms Activated/Deactivated events.
I've looked though my MSDN and it happily defines the ISite interface properties but it doesn't show how the whole thing fits together.
Also, when I debug the component, this.Site and this.Comtainer are both null...Is there an attribute I need to add to the Component?
Thanks for any help you can give me on this guys (and Gals!)
Pete
Insert Sig. Here!
|
|
|
|
|
Um, perhaps in your form OnLoad :
MyControl.Site = (ISite)this;
"The greatest danger to humanity is humanity without an open mind." - Ian Mariano
http://www.ian-space.com/
|
|
|
|
|
Surely you havent got to wire this stuff up yourself? I may as well write my own Parent property if that were the case...
Anyone?
Pete
Pete
Insert Sig. Here!
|
|
|
|
|
Prepare a constructor with a IContainer param. This will be used to pass the parent. In System.Windows.Forms.Timer :
public Timer() : base() {
this.interval = 100;
}
public Timer(IContainer container) {
this = new Timer();
container.Add(this);
}
As you can see, this code doesn't store the reference to the parent anywhere, but that's up to you to do so.
Back to real work : D-28.
|
|
|
|