|
Been searching eveything I know to search and cant find anything specific enough.
Is there a way to make an XML file into a data source so I can take advantage of the Data-Aware capibilities in Visual Studio 2008.
I would like to use the Data Source and Data Navigator to develop a simple data entry form that had 6 data bound textboxs and a child DataGridView with the ability to add, delete and modify some small(300-500 items) xml files. In other words use the XML files like I would use SQL server.
Thanks in advance for any comments or suggestions and links to any examples would be helpful.
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
Well sort of. I do not know of a way to do this directly, although there may be one.
However, the DataSet class has a ReadXml method as, I believe, does the DataTable class. Obviously they both also have WriteXml methods too. So you can create a DataSet, or DataTable, in memory and read the XML into it. From then on it is just like using SQL Server.
If you Google/Bing for dataset.readxml you will find loads of examples.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thanks Henry
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
Found this if anyone is intrested...
Using XML as Database[^]
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
Good afternoon.
We want a user to enter a date as 08/07/2009, but if someone enters 08/07/09 we want to format it correctly, but any other dates like 08/07 will be rejected. I know InfoPath automatically changes 09 to 2009 depending on the format of the field. What makes it additionally challenging, is if someone enters 08/07/20 (deletes the 09 in error), we wouldn't want it to format 08/07/2020.
Any suggestions? Thank you, WHEELS
|
|
|
|
|
While you can most definitely enforce the ##/##/#### format they could try British style dates. DateTime.ParseExact[^] can be used to check to see if it is valid. Any logic you want you will have to combine with if statements. I would recommend against and format input boxes as they always seem to cause problems. Now, using a DateTime picker with a custom format is also a perfect solution.
|
|
|
|
|
Thank you. Have a great weekend.
|
|
|
|
|
How will the user enter the data? Are you using WinForms? If so, you could just use a DatePicker Control and set the format however you want
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
The users are enter data in a datagrid view on a winform.
|
|
|
|
|
Maybe try something like this...
DateTime dt = DateTime.Now;
if(DateTime.TryParseExact("DATEVALUE", "MM/dd/yy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dt))
{
DataGridViewCell.Value = dt.ToString("MM/dd/yyyy");
}
else if(!DateTime.TryParseExact("DATEVALUE", "MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dt))
{
}
NOTE 1: you could add some logic here to test if the year is 20 but I would suggest you leave trying not to allow it to be converted to 2020 as that is what should be expected, plus if you validate each cell when it has lost focus then the user will see the change and can edit if it is wrong
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
|
PIEBALDconsult wrote: It is my firm belief that the DataGrid(View) was developed solely to demonstrate the power of ADO.net and should never be used in a production application.
Have 5, I want to form a club - those who refuse to use a DGV for editing.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks, I don't get many.
|
|
|
|
|
Your 2 most useful responses are from Ennis - use a datetime picker and Piebald - DON'T USE A DGV FOR EDITING, pop a dialog and let the user edit in the dialog (using the datetime picker).
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi Ive created an application using c# vs2008 and sql server 2005
on my pc everything works fine, but when i release it onto a server it has trouble connecting to the database.
Im using Linq - ive created a DataLinq project, a DataAccess project and a BusinessLogic project...
For the Linq project i simply added a dbml file, dragged all the necessary tables across and voila...
If I do a search for 'connectionString' in the DataLinq project - it appears in a number of places with the actual value hard coded - its in:
app.config
bin\Debug\DataLinq.dll.config
DBLinq.dbml
Settings.Designer.cs
Settings.settings
I would expect it in the app.config file - am I expected to change it in all the locations before release or am i doing something wrong?
Cheers,
Chas
|
|
|
|
|
Just app.config will be enough!
bin\Debug\DataLinq.dll.config is a copy of app.config made by VS on build success.
application settings are written to the app.config as well (in settings you can choose application or user)
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
I add two splitconrainers. The panel at the topmost will have a problem. The top region of Panel will be covered by toolstrip. But I woudl to draw some thing like pixture to fill the Panel. How do I modfy this problem to prevent the panel covered by toolstrip?
http://cid-fbeb6373d9321a7f.skydrive.live.com/self.aspx/Questions/Visual%20C%7C3/VC%7C3%7C_spliContainer%7C_dosck%7C_region.jpg
You can the jpg file, the top region of the topmost panel is covered with toolstrip.
|
|
|
|
|
Hi,
Is this just a problem with the way you have constructed the form in the designer? With docking controls you really need to start at the outside and work in towards the middle.
1) Form
2) menu strip
3) tool strip
4) split container.
Alan.
|
|
|
|
|
When this sort of thing happens, simply right-click on the control that is partly hidden and from the context menu that appears click Bring To Front.
Problem Solved!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
hi,
I m using MS-Index Services, everything doing well
But i want to Retrieve Office Document(doc,xls)html etc Metadata
means some text area just like google web site Result.
somebody help me for configuration and query for retrieve documents text part.
|
|
|
|
|
I want to remove the http response header using regular expression
for example the following is the response i get
-----------------------------------------------
HTTP/1.1 200 OK
Date: Fri, 07 Aug 2009 18:10:29 GMT
Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.8
X-Powered-By: PHP/5.2.8
Content-Length: 140
Connection: close
Content-Type: text/html
A Word a Moment
Word : somber
Pron : sombu(r)
Meaning :
1. Lacking brightness or colour; dull
Example : (empty)
---------------------------------------------------
and i need only the text after "A word a moment"
so i thought of this code which is not as expected
string outs = Regex.Replace(cont, "^.*\r\n\r\n", "", RegexOptions.Multiline);
what could be the pattern to remove the http response header so that i can just use the actual response?
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
I think it would be easier for you if you don't use a regexp. You can simply drop all the header, directly when reading from the socket's stream.
If you can only have the full text in a string (for example if you are using a third-party library and cannot modify the code which reads from the socket), then you can parse it and find the beginning of the text you need.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
sure. but i thought i can include the knowledge of using regex with win32. actually i already have a program written in win32 api which is working well. in that i used strpos to find the two \r\n\r\n to find the end of the response header. coding in win32 api to accomplish my need gets tedious so i am writing the same program in c#. instead of the old way i thought of trying new. anyway do you know how to read the response body using any of System.Net.Sockets ? ... and the program is here ... http://vikku.info/wordreminder/[^]
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
Ok I see. Well, if you want to use regexps, the easiest way I can think of is something like:
string HttpText = "HTTP/1.1 200 OK\r\nDate: Fri, 07 Aug 2009 18:10:29 GMT\r\nServer: Apache
/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimi
ted/1.4 FrontPage/5.0.2.2635 PHP/5.2.8\r\nX-Powered-By: PHP/5.2.8\r\nContent-Length: 140\r\
nConnection: close\r\nContent-Type: text/html\r\n\r\nA Word a Moment\r\nWord : somber\r\n\r
\nPron : sombu(r)\r\n\r\nMeaning :\r\n1. Lacking brightness or colour; dull\r\n\r\nExample
: (empty)\r\n\r\n";
Regex MyRegex = new Regex("\r\n\r\n");
String[] MyStrings = MyRegex.Split(HttpText, 2);
if (MyStrings.Length != 2)
{
throw new ApplicationException("Error parsing HTTP response!");
}
Console.WriteLine("Header:");
Console.WriteLine("-------");
Console.WriteLine(MyStrings[0]);
Console.WriteLine("Body:");
Console.WriteLine("-------");
Console.WriteLine(MyStrings[1]);
Console.WriteLine("-------");
But it doesn't make much sense to use the Regex object here, since the pattern separating header from body is a fixed string ("\r\n\r\n"), so the same can be done using String.Split() , which is simpler and more performing.
If you want to use Regex.Replace() , like in your example, then you will have to limit the number of matches to replace to one, otherwise ALL matches will be replaced with the empty string! See the docs here[^].
Regarding how to read data from a socket, if you check the docs for objects in System.Net.Sockets , like TcpClient[^], you'll see they expose methods to obtain a NetworkStream[^], which you can use to read data.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
Excellent. thank you for your needful reply. the tcpclient will help for now and also i will tinger with the others. i had a quick view of your links and i have to spend more time on that.
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|