|
I don't recall, but if in certain conditions you get an exception then you've found a bug
I have no smart signature yet...
|
|
|
|
|
Hi
I wanted to ask if it is possible to do something like this and how to do it:
I would like to have a xml structure like this:
<root>
<collection>
<element />
<element attribute="value" />
<element />
</collection>
<something />
<somethingother />
</root>
The elements in the collection should be of the type ElementBase if the attribute is not set or of the type ElementDerived if the attribute is set to a value (the second element).
So the Deserialized collection should be something like:
List<ElementBase> collection = new List<ElementBase>() { new ElementBase(), new ElementDerived(), new ElementBase() };
ElementDerived would be derived from ElementBase:
class ElementDerived : ElementBase {}
I hope my question is described clearly.
Thanks for your help
Roland
|
|
|
|
|
|
This is possible if you write your own custom xml deserializer.
Based on your xml rules build the deserialization rules and then, at the parsing of element nodes, check if there is an atribute defined, and based on the result instantiate your element class.
But I don't understand why you want to use something like this (inheritance), why not just put a flag in the base class (a bool flag, or an enum flag) to diferentiate between the two element types?
I have no smart signature yet...
|
|
|
|
|
i have an application in a machine and i want to make access on it through an other machine , how can i make that,plz help ?
|
|
|
|
|
it depends on what information you will be passing between the aplications, and your architecture - for example, if you have an application on a machine, lets call that the server side, how many other computers 'clients' are going to be connecting to the server and requesting services or transferring data
- I would start looking at remoteing, wcf type technologies - ie, you possibly need to start thinking about tcp/ip sockets type connectivity, and there are easy and hard ways to do that depending on your requirements.
Its harder to give you a better answer without a more detailed description of what you are trying to achieve, sorry
'g'
|
|
|
|
|
Hello,
Tell me more about the type of application you have. Is it a windows form, console application or a website?
Nicolas.
|
|
|
|
|
any way the application is depend on the distributed systems , so i want to just access to the other machine so you can say that i want to make remote desktop like that in windows ....
what can i do with c# ?
|
|
|
|
|
|
how to get number of records selected?
SqlDataReader dr1 = cmd1.ExecuteReader();
|
|
|
|
|
I don't think you can tell ahead of time how many records will be returned. If you need to know that, then you can use a COUNT function in your SQL or loop through the records and count them as you go.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
The other way will be to use a dataset and do a count of that dataset:
SqlDataAdapter sqldataadap = new SqlDataAdapter(objCmd); //objCmd is your Sql Command Object
DataSet ds = new DataSet();
sqldataadap.Fill(ds);
//get the # of rows:
int irow=ds.Tables[0].Rows.Count;
|
|
|
|
|
After running any type of query just fire following query to know
number of rows affected.
SELECT @@rowcount AS 'RowsChanged'
Hope this will help!
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Fill a data adapter with a dataset. Then count the rows.
Some thing like:
int totalRow = Dataset.Tables[0].Rows.Count;
|
|
|
|
|
The reader does not have a count.
You could however use an ExecuteScalar to get the count.
int i = (int)cmd1.ExecuteScalar();
|
|
|
|
|
How exactly do you reckon this will return the row count?
What is cmd1.CommandText in this case?
|
|
|
|
|
I have finished building an desktop application that is similar to Yahoo Messenger.
It has a client side and a server side and it is built using System.Runtime.Remoting
and uses a Singleton model.
I have registered a channel on the client side and on the server side like this:
ChannelServices.RegisterChannel(channel,false);
...
MarshalByRefObject obj = (MarshalByRefObject)RemotingServices.Connect(typeof(IServer),
"http://"+hostIP+":8980/Server");
Global.server=obj as IServer;
(obj as RemotingClientProxy).Timeout=5000;
where hostIP an IP address of the server location.
Until now I have used only 127.0.0.1 (localhost) for the server , but when I change the value to
my IP address, I get the following error:
{"Unable to connect to the remote server"} System.Exception {System.Net.WebException}
with the message :
"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"
Does anyone knows how to solve this issue? Should I configure in some way the server(my computer) ?
Please help me .
Thanks in advance!
|
|
|
|
|
Your firewall is probably on. Open port 8980 for the interface on which you are trying to connect.
|
|
|
|
|
I have turned off my firewall and I don't get any error but now it doesn't connect at runtime with the server.
Do you have any other ideas I could try?
|
|
|
|
|
Not really
Is this your pc's IP address, or the IP address of your Internet router? If it's your router, you'll have to set up port forwarding on the router.
|
|
|
|
|
I think is the IP of the router ...
Could you give me an idea about how should set up this port ?
Thanks for your reply !
|
|
|
|
|
Your should read your routers documentation for that.
The general principle is that an incoming connection on your router's ip is forwarded to a pc on your network, so in your case you should forward port 8980 on the routers external interface to port 8980 on your pc (giving the ip address of the pc)
|
|
|
|
|
Hello,
I would execute this commande : ftp -s:c:\config.txt
whene i excute this command in cmd console, it work, but how i can excute it in c#, please help me to resolve this great problem, thank you verry mutch.
|
|
|
|
|
|