|
John Simmons / outlaw programmer wrote: So easy, a caveman could do it.
Chicken (Space Jam) said: I resemble that remark!
|
|
|
|
|
how that ?
can you explain about this .
thank.
|
|
|
|
|
Hi. I'm new to C# and mostly programming in general. I have been writing SQL and working with SQL Server as a systems analyst for 13 years so I'm comfortable there plus I've written a little VBA here and there. Otherwise... newbie. Here's my question. I'm creating a C# Winform app in Visual Studio 2008 that I eventually want to distribute to other people for personal use. These other people are not in the same building or on the same network. I've been using SQL Server for the data, but how would I distribute that? I assume that I can't. I obviously don't want to require them to install SQL Express. So how do you create distributable apps for personal consumption? What do you use for the data? Thanks in advance.
|
|
|
|
|
If it is a small application dealing with less amount of data, XML files or MS Access could do. Or else, SQL Express should be installed on those computers.
If all the computers are on internet, you can connect to SQL server over internet also. Check that out.
|
|
|
|
|
d@nish wrote: If it is a small application dealing with less amount of data, XML files or MS Access could do. Or else, SQL Express should be installed on those computers.
If all the computers are on internet, you can connect to SQL server over internet also. Check that out.
Thanks for the quick reply d@nish.
|
|
|
|
|
Welcome.
|
|
|
|
|
If the user has internet then u can keep ur data on server so that they can access this data from internet
|
|
|
|
|
Let's assume, for argument sake, that the user is disconnected from the internet. How could the user enter and save data?
Thanks.
|
|
|
|
|
then u must provide them data on their local machine.....
|
|
|
|
|
I usualy just store data in a DataSet and then you can save it and load it easily using xml binds. It's very easy.
DataSet t = new DataSet();
t.Tables.Add(someTable);
t.WriteXmlSchema("Filename");
t.WriteXml("Filename");
DataSet loaded = new DataSet();
loaded.ReadXmlSchema("Filename");
loaded.ReadXml("Filename");
|
|
|
|
|
Thanks. I will definitely explore that option.
|
|
|
|
|
SQL Server Compact Edition. It's like full blown SQL Server, with some limitations (e.g., 4GB database size limit, can't create stored procedures so you have to do everything with queries). The major advantage is that it gets installed with .Net, so it's already on their computers.
|
|
|
|
|
I was literally just reading about that. I think that's what I'm going to try first since I'm already familiar with the platform. Thanks for the reply.
|
|
|
|
|
Kris,
Before you spend time trying to figure how to get your users to access a local or remote database, take the time to determine if they need to access a database in the first place. Chances are you could easily get by saving your data to XML or a simple binary store using file I/O.
I'm reminded of the saying, "if the only tool you have is a hammer, every problem looks like a nail."
/ravi
|
|
|
|
|
Good morning.
I am trying to populate City and State fields based on a Zip entered and I am getting an Webservice Data at the root level is invalid. Line 1, position 1. error.
The XML return from the webservice is as follows:
<?xml version="1.0" encoding="utf-8" ?>
- <NewDataSet>
- <Table>
<CITY>Portland</CITY>
<STATE>ME</STATE>
<ZIP>04104</ZIP>
<AREA_CODE>207</AREA_CODE>
<TIME_ZONE>E</TIME_ZONE>
</Table> </NewDataSet>
My code is as follows:
private void btnZipWS_Click(object sender, EventArgs e)
{
XmlDocument doc = new XmlDocument();
Bank.net.webservicex.www.USZip ws = new Bank.net.webservicex.www.USZip(); XElement Results = XElement.Parse(ws.GetInfoByZIP (txtZip.Text).ToString());
foreach (XElement xe in Results.Elements("NewDataSet").Elements("Table").Descendants())
{
if (xe.Name == "CITY")
{
txtCity.Text = xe.Value;
}
if (xe.Name == "STATE")
{ txtState.Text = xe.Value;
}
}
}
Is there an issue with the XML being returned? I wasn't sure what the - signs were for.
Thank you, WHEELS
|
|
|
|
|
The most glaring thing is the hyphens before the root tags.
Further, your code should probably look more like this:
XElement element = Results.Elements("NewDataSet").Element("Table");
string city = element.Element("CITY").Value;
string state = element.Element("STATE").Value;
... blah blah
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
The problem I am having now is that th eLoad is looking for a physical XML file on my computer, but it is being called from a Web Service.
XDocument doc = XDocument.Load(ws.GetInfoByZIP(txtZip.Text).ToString());
private void btnZipWS_Click(object sender, EventArgs e)
{
Bank.net.webservicex.www.USZip ws = new Bank.net.webservicex.www.USZip();
XDocument doc = XDocument.Load(ws.GetInfoByZIP(txtZip.Text).ToString());
XElement element = Results.Elements("NewDataSet").Element("Table");
string city = element.Element("CITY").Value;
string state = element.Element("STATE").Value;
WHEELS
|
|
|
|
|
Since you're getting an XML string back from the web service, you want to use this:
XDocument doc = XDocument.Parse(textZip.Text);
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Hi John.
I am semi-following. I wouldn't be parsing the txtZip.Text. That is a textbox on the form and the data is being passed to the WS call.
XDocument doc = XDocument.Parse(ws.GetInfoByZIP(txtZip.Text).ToString());
When I use this, I am getting this error:
Data at the root level is invalid. Line 1, position 1.
WHEELS
|
|
|
|
|
Like I said in my original response - you have hyphens preceding the two root-most elements. That makes your XML invalid.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Very new to XML. What do I do to compensate for the - s? WHEELS
|
|
|
|
|
it is not valid XML as long as those hyphens are there. Eradicate them.
|
|
|
|
|
|
Isn't that what I told you, too?
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Hi John.
I believe you did. Having a very challenging time with this XML/WebService, and didn't expect to enough these hypens.
Thanks again.
WHEELS
|
|
|
|