|
HOW CAN I WRITE XML FROM LIST COLLECTION ???
I have List like
KeyValuePair<int, List<Point2D>> arcCollection
here total item in arcCollection is 30.
i.e arcCollection.count =30
And each List<Point2D>> i have stored 3 points(x1,y1 x2y2 x3y3)
Each there any way out that to write XML of value of List<Point2D>> for each arcCollection.count
wthe regards
tarak
|
|
|
|
|
Look into XDocument and LINQ. You could also add the items using a loop. If all else fails, then this piece of C# code should give you the general idea:
using System.Xml.Linq;
XDocument xDoc = new XDocument(new XElement("root",
new XElement("key", arcCollection.Key),
new XElement("values",
from Point pt in arcCollection.Value
select new XElement("point",
new XElement("x", pt.X),
new XElement("y", pt.Y)
)
)
));
That piece of code iterates through every Point structure in arcCollection.Value, and creates a nice neat XML structure. I didn't have the Point2D structure definition with me, so I used the Point structure instead, but this is still fairly neat. If you need to add properties, then look at the lines which reference pt.X and pt.Y . They form a list, and you simply have to add the properties as XElements like I did. Don't forget to change the definition of pt to a Point2D structure though, otherwise the code probably won't even compile
|
|
|
|
|
XmlSerializer.
Although you might need to modify your object hierachy.
You can read/write the serialized object output to streams and files.
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|
|
Hello every one,
I am developing an server side application which can communicate with its client.
When server wants to communicate with its client, server will send sms to client to get ip address. After establishing connection between server and client,client will send some log file to server.Server will receive that file and store it into the database.
My problem is, how can i achieve this, means on server side there will be a .net application(exe) or there will be web page(asp.net)
Please help me on this.
modified on Friday, May 29, 2009 2:29 AM
|
|
|
|
|
Hi yrishi
You need to change your approach in this scenario
prepare a server desktop application(.exe) which will listen on particular port
prepare a client application which establish connection with server. Once the connection is made then you can transfer the file or other object you want
|
|
|
|
|
really thanks for your reply, actually my confusion is how to access .exe from multiple location as i am having more than one user to access that .exe application
If i go through web application, then user can access it from anywhere.
so which is better choice?
|
|
|
|
|
Use .Net remoting. If your clients are distributed across network within the verges of firewall, you can build a server program on a specified port.
You can build client program which is expecting service from the same port on a server IP. 
|
|
|
|
|
Thanks for your reply. I'll check it.
just tell me, can i do socket programming with asp.net? means at server side, there will be my web page and when i am in listening mode client can communicate me through the specific port no. is it possible in asp.net?
|
|
|
|
|
Sorry abt the late reply and you can establish socket connection from asp.net. Google it you will be getting more articles.
|
|
|
|
|
hey thats fine, I'll check it. really thanks for your reply.
actually i have again post my problem briefly. Please reply if get any idea
|
|
|
|
|
Hey folks, I am doing some preliminary research for a fairly large forms/data-driven business application I am due to develop. There are 4 basic requirements for this application:
1. Can install/run app on local PC or as a hosted application (access via Web Browser to our hosted server). This includes the Database.
2. The local version may be a Windows-only application.
3. The hosted version must run cross-browser (IE and Firefox minimum).
4. The local version must have a simple installer (via Web or CD) and can Auto-Update.
I have a modest amount c#, ASP.NET and SQL experience but am overwhelmed by the choice of .NET technologies available and would like some opinions. Ideally I would like just one codebase but the more I look at it, the less feasible that seems. Maintaining 2 apps doesn't sound so much fun.
My first thought was an ASP.NET app that could be packaged with UltiDev Cassini and deployed locally but I'm not sure it's robust/secure enough (thoughts?) Other choices seem to be:
Local
- WinForms
- WPF or XBAP
- ASP with Cassini or Web Deployment tool.
Remote/hosted
- XBAP
- ASP.NET/MVC/Ajax
- Silverlight
I've noted that you can potentially deploy a WPF app natively and as a XBAP using Prism, like to hear thoughts on that.
Then there's the data access strategy, which I'm not sure about either! 
|
|
|
|
|
Potentially you could look at using Silverlight and WPF. It's possible to share quite a bit of code between Silverlight and WPF if you know the tricks and gotchas. Take a look at the work we've done on Onyx[^] to get some ideas.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Thank you very much Pete, I'm going to take a closer look at Onyx, Prism and Caliburn and figure out how they relate.
Appreciate any other comments and opinions from folks. 
|
|
|
|
|
I'm biased towards Onyx - it solves problems that Prism and Caliburn ignore, and I am the person working on the Silverlight code of Onyx.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
I'm trying to hook the ReadFile API like FileMon does.
Do you have an example of ReadFile?
Please help me .....
|
|
|
|
|
Please don't cross post. It's bad form.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hi all, I'm trying to move my app from tcp to ipc, but i keep getting
Failed to connect to an IPC port: the System cannot find the file specified.
The server is a service running with Local System account.
Client and server work fine with tcp. Those are my configuration files:
Client:
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref="IPC" portName="2001" timeout="900000" name="mwchannel">
<clientProviders>
<formatter ref="binary" />
</clientProviders>
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full" />
</serverProviders>
</channel>
</channels>
<client>
<wellknown type="MW.Remote.RemoteConnection, RemoteConnection" url="IPC://MWPort/MWServer/RemoteConnection.rem" />
</client>
</application>
</system.runtime.remoting>
</configuration>
Server
<configuration>
<system.runtime.remoting>
<application name="MWServer">
<channels>
<channel ref="ipc" portName="MWPort" authorizedGroup="Everyone" timeout="3000">
<serverProviders>
<provider ref="wsdl" />
<formatter ref="soap" typeFilterLevel="Full" />
<formatter ref="binary" typeFilterLevel="Full" />
</serverProviders>
<clientProviders>
<formatter ref="binary" />
</clientProviders>
</channel>
</channels>
<service>
<wellknown mode="Singleton" type="MW.Remote.RemoteConnection, RemoteConnection" objectUri="RemoteConnection.rem" />
</service>
</application>
<customErrors mode="Off">
</customErrors>
</system.runtime.remoting>
</configuration>
What is strang to me is that the same error appears if I shut down the server, so I suppose that the client is not even able to 'see' the server. Does someone spot any error or knows about possible causes?
Thank you!
|
|
|
|
|
Dear Sir,
How to store logout time .if user shutdown the page from standard cross button.
Thank you
|
|
|
|
|
If you are talking WinForms there are Closing and Closed events you can handle.
If this is ASP.NET then I don't think there is anything you can do (you may get an answer on the ASP.NET forum)
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
You're absolutely right Colin. All you could tell is that the form was closed somehow.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
|
i hav written following code for login page..
SqlConnection con=new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=MLM;Integrated Security=True");
SqlCommand com=new SqlCommand("select UserName,Login_Password from RegistrationForm",con);
con.Open();
SqlDataReader rs = com.ExecuteReader();
while (rs.Read())
{
if ((rs[0].ToString() == T1.Text) && (rs[31].ToString()== T2.Text))
{
string s1 = T1.Text;
Response.Redirect("HOME.aspx?UserName=" + s1);
return;
}
else
{
Response.Write("Unsuccessful Login");
T2.Text = "";
T2.Focus();
}
}
rs.Close();
com.ExecuteNonQuery();
con.Close();
bt the error occured is Array index out of bound....bt when i take rs[1] instead of rs[31],then error is like unsuccessful login
|
|
|
|
|
manjusha s wrote: .bt when i take rs[1] instead of rs[31],then error is like unsuccessful login
Well, that's what your code is supposed to say when you type a wrong password. This is what happens, whit rs[2];
Here you check whether username and password combination are present in the database
if ((rs[0].ToString() == T1.Text) && (rs[31].ToString()== T2.Text)) If they don't exist, then the computer will execute the else-part;
else
{
Response.Write("Unsuccessful Login");
T2.Text = "";
T2.Focus();
} There is your message. Shouldn't happen when you use a password that is in the database.
Now, when you simply change the number of the index to 31, your code becomes broken; there aren't 31 fields in that query, so it tries to read from memory that ain't there.
select UserName,Login_Password from RegistrationForm returns two fields, not 31.
I are troll
|
|
|
|
|
your code is good and validate user and password but is not optimazed.
exception occered in
if ((rs[0].ToString() == T1.Text) && (rs[31].ToString()== T2.Text))
because in your query you select only two columns from table
and sql server return two selected columns but use number 31 for index.
when you read data by SqlDataReader you can use indexed mode
sqlDataReader[item index]
item index must one less from columns count or one less from sqlDataReader.FieldCount
to solve your problem change your if to
if ((rs[0].ToString() == T1.Text) && (rs[1].ToString()== T2.Text))
for indexing item in datareader and dataset it not importent how many columns is in table it importent how many columns are selected in query
|
|
|
|
|
Hello everyone ,
I have an issue i.e, I am using crystal report(version 11 release 2) in my windows applications developed in vb.net (2005)and sql server(2005) as backend . In one of the forms i placed one reportviewer control,
crystal report taking long time for preview & print(nearly 2 minute) .
please any one help me to getout of this
Dim rpt As New CrystalReport1() 'The report you created.
Dim myConnection As SqlConnection
Dim MyCommand As New SqlCommand()
Dim myDA As New SqlDataAdapter()
Dim myDS As New Dataset1() 'The DataSet you created.
Try
myConnection = New SqlConnection("Data Source=localhost;Integrated Security=SSPI;" & _
"Initial Catalog=northwind;")
MyCommand.Connection = myConnection
MyCommand.CommandText = "SELECT * FROM Customers where cid=10"
MyCommand.CommandType = CommandType.Text
myDA.SelectCommand = MyCommand
myDA.Fill(myDS, "Customers")
rpt.SetDataSource(myDS)
CrystalReportViewer1.ReportSource = rpt
Catch Excep As Exception
MessageBox.Show(Excep.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
I asked This Question Already but No one ready solve my Problem.
Please tell how to increase My Crystal report Preview ? My staff scolding me. please
Advance thnx.
|
|
|
|