|
You have everything need. Just because it doesn't have the specific phrase or keyword you are looking for doesn't mean the answer isn't there. At some point in your career you will be asked to figure something out on your own.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Do not remove your messages when done, it is against the forum guidelines.
|
|
|
|
|
Hello,
I'm developing an IDE, in which I need my users to write Xml files. Since I'm providing code completion, I need to know what elements and attributes are available to my users depending on what element they are in, based on an Xsd schema.
Currently I am trying to do this with a schema file, an xml file and a XmlReader. The way I was going to do it was to make the XmlReader generate a tree of available elements/attributes based on the given schema file. However, so far my debugging results show me that none of the, IMO, logical properties have the current node's name, child attributes and child elements. Here's my C# code:
using System;
using System.IO;
using System.Xml;
using System.Xml.Schema;
namespace Moonlite.Controls.Xsd {
public static class XsdReader {
public static XsdNodeCollection Read(Stream stream, Stream schema) {
XsdNodeCollection nodes = new XsdNodeCollection();
XmlReaderSettings settings = new XmlReaderSettings();
settings.ValidationType = ValidationType.Schema;
XmlSchemaSet schemas = new XmlSchemaSet();
settings.Schemas = schemas;
settings.IgnoreWhitespace = true;
settings.IgnoreComments = true;
schemas.Add(null, XmlReader.Create(schema));
XmlReader reader = XmlReader.Create(stream, settings);
try {
while (reader.Read()) {
string currentNode = reader.Value;
}
}
finally {
reader.Close();
stream.Close();
schema.Close();
}
return nodes;
}
public static XsdNodeCollection Read(string filename, Stream schema) {
return Read(File.Open(filename, FileMode.Open), schema);
}
}
}
reader.Value has so far only returned values such as the generic Xml header ("<? xml... ?>"), "" and "\n".
Please bear with me, as this is the first time I am working with data validation.
Thanks,
Theo
|
|
|
|
|
Hello All.
I have a question about database.
I had used a oledb data adaptor and oledb commadn builder for update a row in a table.
I recieved this error:
"Dynamic SQL generation for the UpdateCommand is not supported by a SelectCommand that does not return any key column information"
Who knows the reason of this error?
I am in horry. Please Answer me.
Thanks everybody
|
|
|
|
|
Google using your error message gave this site[^] as it's top link. Along with 1919 other sites.
I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in.
Apathy Error: Don't bother striking any key.
|
|
|
|
|
can anyone guide on what's the best way to create my own database using binary files and C#?
|
|
|
|
|
Um. Don't?
To be honest, unless you are doing something really small and trivial, the work involved is going to be ridiculous for the reward you will get. Just working out the record locking if it is to be multi-user will be pretty horrible. Then there is the space allocation, the different variable storage requirements, and so forth.
If you just need to store single user values, then go with XML or SOAP.
If you need to store multi-user data, or delete / insert records, then use SQLExpress or MySQL - both are free and will be a lot less hassle to get working and debugged.
I have learnt that you can not make someone love you, all you can do is stalk them and hope they panic and give in.
Apathy Error: Don't bother striking any key.
|
|
|
|
|
Don't try. If you just need to store something, just do it but don't call it a database. If you need a database, use a database, if you make one yourself it will just have a ton of bugs..
And "binary file" is a pleonasm. All files are binary. Just, some binary files are also something else (a text file is also a binary file, etc). I'm sure you know that, but it looked suspicious.
If the point is just trying to make a database just for the heck of it, that's nice, I'd start by reading the relevant articles on wikipedia
|
|
|
|
|
hi,
i've made a relational DBMS (database management system) for smart devices for my college diploma, based on binary files and XML.
In the XML it describes the structure of the database then the data will be written in binary files, and the search is based on indexing each column (the indexing algorithm is based on hashtables).
I've worked very hard and for long time to acomplish what is allready done with succes and no headaches by Microsoft or Sun.
Conclusion: The job is a little too much for 1 programmer and not worth the effort.. i was very stubborn to do this.
See this: [DBMS Wiki] and [RDBMS].
|
|
|
|
|
Hi everybody,
I am trying a smart device application.
the problem is after i execute a querry that should insert a new line in a table, i go to check if the line existe really in the table then i don't find it.
this is the code i used.
Thank you for your help in advance.
private void menuItem4_Click(object sender, EventArgs e)
{
string wCS = @"Data Source =\Storage Card\ModeDifféré\BaseGmaoLocale.sdf;";
SqlCeConnection sqlceconn = new SqlCeConnection(wCS);
SqlCeCommand command2 = sqlceconn.CreateCommand();
command2.CommandText = "INSERT INTO compteurs2 ([com], [quantite],[datequantite] ) Values(@com,@qtte,SYSDATE)";
command2.ExecuteNonQuery();
SqlCeParameter com = new SqlCeParameter("@com", SqlDbType.NVarChar);
com.Value = comComboBox.SelectedItem.ToString();
command2.Parameters.Add(com);
SqlCeParameter qtte = new SqlCeParameter("@qtte", SqlDbType.Float);
qtte.Value = float.Parse(textBox1.Text);
command2.Parameters.Add(qtte);
}
|
|
|
|
|
I think you should execute the command afther you add the parameters to it, or else the insert will fail (as it has so far) havning nothing to insert.
Something like this:
private void menuItem4_Click(object sender, EventArgs e) {
string wCS = @"Data Source =\Storage Card\ModeDifféré\BaseGmaoLocale.sdf;";
SqlCeConnection sqlceconn = new SqlCeConnection(wCS);
SqlCeCommand command2 = sqlceconn.CreateCommand();
command2.CommandText = "INSERT INTO compteurs2 ([com], [quantite],[datequantite] ) Values(@com,@qtte,SYSDATE)";
SqlCeParameter com = new SqlCeParameter("@com", SqlDbType.NVarChar);
com.Value = comComboBox.SelectedItem.ToString();
command2.Parameters.Add(com);
SqlCeParameter qtte = new SqlCeParameter("@qtte", SqlDbType.Float);
qtte.Value = float.Parse(textBox1.Text);
command2.Parameters.Add(qtte);
command2.ExecuteNonQuery();
}
Oh and, I an not 100% sure, but I think that SYSDATE is not supported in SQL CE, the one that should work is GETDATE() .
I have no smart signature yet...
|
|
|
|
|
thank you for your suggestion but it still doesn't work.
|
|
|
|
|
What is the code you run now and what si the result (any exceptions?).
I have no smart signature yet...
|
|
|
|
|
this is the code:
private void menuItem4_Click(object sender, EventArgs e)
{
DateTime t = DateTime.Now;
string wCS = @"Data Source =\Storage Card\ModeDifféré\BaseGmaoLocale.sdf;";
SqlCeConnection sqlceconn = new SqlCeConnection(wCS);
SqlCeCommand command2 = sqlceconn.CreateCommand();
command2.CommandText = "INSERT INTO compteurs2 ([com], [quantite],[datequantite] ) Values(@com,@qtte,@dat)";
SqlCeParameter com = new SqlCeParameter("@com", SqlDbType.NVarChar);
com.Value = comComboBox.SelectedItem.ToString();
command2.Parameters.Add(com);
SqlCeParameter qtte = new SqlCeParameter("@qtte", SqlDbType.Float);
qtte.Value = float.Parse(textBox1.Text);
command2.Parameters.Add(com);
SqlCeParameter dat = new SqlCeParameter("@dat", SqlDbType.Float);
dat.Value = t;
command2.Parameters.Add(dat);
command2.ExecuteNonQuery();
}
and i didn't see any exception.
|
|
|
|
|
I think that:
a) you connection is not opened
b) yout command is not attached to that connection
c) adding twice the com parameter does not solve anything
d) the @dat parameter should by datetime
Most probably this code should work:
private void menuItem4_Click(object sender, EventArgs e)
{
string wCS = @"Data Source =\Storage Card\ModeDifféré\BaseGmaoLocale.sdf;";
using(SqlCeConnection sqlceconn = new SqlCeConnection(wCS))
{
string insertString = "INSERT INTO compteurs2 ([com], [quantite],[datequantite] ) Values(@com,@qtte,@dat)";
SqlCeCommand command2 = sqlceconn.CreateCommand(insertString, sqlceconn);
SqlCeParameter com = new SqlCeParameter("@com", SqlDbType.NVarChar);
SqlCeParameter qtte = new SqlCeParameter("@qtte", SqlDbType.Float);
SqlCeParameter dat = new SqlCeParameter("@dat", SqlDbType.DateTime);
com.Value = comComboBox.SelectedItem.ToString();
qtte.Value = float.Parse(textBox1.Text);
dat.Value = DateTime.Now;
command2.Parameters.Add(com);
command2.Parameters.Add(qtte);
command2.Parameters.Add(dat);
command2.Connection.Open();
command2.ExecuteNonQuery();
}
}
I have no smart signature yet...
|
|
|
|
|
thank you but for the line:
SqlCeCommand command2 = sqlceconn.CreateCommand(insertString,sqlceconn);
the following error occurs:
Error 1 No overload for method 'CreateCommand' takes '2' arguments C:\Users\Admin\Documents\Visual Studio 2008\Projects\GMAOMobile\ModeDifféré\Energie.cs 107 41 ModeDifféré
what is the problem?
|
|
|
|
|
My bad, try
SqlCeCommand command2 = sqlceconn.CreateCommand();
command2.CommandText = insertString;
or
SqlCeCommand command2 = new SqlCeCommand(insertString,sqlceconn);
Both do the same thing.
I have no smart signature yet...
|
|
|
|
|
the error was repaired but nothing happened in data base. There is is no line inserted.
|
|
|
|
|
How do you check if your line has been inserted?
I have no smart signature yet...
|
|
|
|
|
i open the table from visual studio after closing the application and i check if there is a new line inserted.
|
|
|
|
|
Most probably the table opened from visual studio is just a local copy of the database file.
Your operation is made on the smart device simulator, on that database. You can download the file from the smart device and check the row is inserted, or you can execute a select command on the device to check the row count.
I have no smart signature yet...
|
|
|
|
|
|
Sr...Frank wrote: Please let me know right code.
By this you mean, write code for me. No. You have a list of the child windows, iterate through them and close.
If you have tried and need help, then post what you have tried and ask.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
private void button2_Click(object sender, EventArgs e)
{
foreach (Form2 f in this.MdiChildren)
{
f.Dispose();
}
}
|
|
|
|
|