|
I can't tell you - tried a quick test with code identical to yours except that I used Schema rather than schema set and got multiple errors.
Good Luck!
|
|
|
|
|
It looks very similar like examples from MSDN. I am surprised it doesn't work....
I don't really have much experience with "new" xml classes in .NET 2.0 , but did you consider XmlSchemaValidator[^]?
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
|
|
|
|
|
Hi friends.
I am cearting my website ... I need "search" in a webform.
for example, when the user types " demo " in the textbox of the search page, then it should appear all the things in all pages of the website,which is correlate with the word "demo".
Just like the search in codeproject.
how can I do it ?
I just know about searching with a specific field,like user name,age,... but I dont have any idea about a word searching ...
is there any articles which can help me?
Or can anyone help me to write ...?
thanks alot.
|
|
|
|
|
Are you searching i a SQL Database?
--
David Trasbo.
|
|
|
|
|
Put "Like" keyword in your select query and pass different parameters i.e syntax may not be write: Select * from Like="AAA",Like"BBB";
|
|
|
|
|
netJP12L wrote: Put "Like" keyword in your select query and pass different parameters i.e syntax may not be write: Select * from Like="AAA",Like"BBB";
sorry I didnt understand ...
What does "like" do ??
What is "AAA" or "BBB" ...?
I want this search form to work with any word...like codeporject's search ...
plz help me
|
|
|
|
|
Yes,Sorry I forgot to say..
My Database is SQLServer 2000
plz help
|
|
|
|
|
You need to set a criteria for how a particular thing will be searched out in your database.
Like is a keyword that tells the query look for something that i am passing in the parameter. Like keyword is different than Equal or ==. As Obvisouly, equal mean look exactly what I need to search.
SELECT *
FROM QUESTION_PARENT
WHERE (PTYPE LIKE 'searchCriteria')
|
|
|
|
|
Is it possible to set xsd-schema during serialization?
The problem is:
1. I have xsd-schema, for example
<<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementformdefault="qualified" attributeformdefault="unqualified">
<<xs:element name="Mass">
<<xs:complextype>
<<xs:sequence>
<<xs:element name="Gross">
<<xs:simpletype>
<<xs:restriction base="xs:decimal">
<<xs:totaldigits value="12">
<<xs:fractiondigits value="3">
<
<
<
<<xs:element name="Net">
<<xs:simpletype>
<<xs:restriction base="xs:decimal">
<<xs:totaldigits value="7">
<<xs:fractiondigits value="4">
<
<
<
<
<
<
<
In this schama two elements are of decimal type, and they have a template for fractional part.
2. Generate class by schema:
public partial class Mass {<br />
<br />
private decimal grossField;<br />
private decimal netField;<br />
<br />
public decimal Gross <br />
{<br />
get {return this.grossField;}<br />
set {this.grossField = value;}<br />
}<br />
<br />
public decimal Net <br />
{<br />
get {return this.netField;}<br />
set {this.netField = value;}<br />
}<br />
}
3. Do the serialization:
public void Test()<br />
{<br />
Mass mass = new Mass();<br />
mass.Gross = 100.1M;<br />
mass.Net = 7.7M;<br />
<br />
XmlSerializer serializer = new XmlSerializer(typeof(Mass));<br />
TextWriter writer = new StreamWriter("res.xml");<br />
serializer.Serialize(writer, mass);<br />
writer.Close();<br />
}
4. Get the result:
<<mass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<<gross>100.1
<<net>7.7
<
The problem is:
I need the elements of decimal type would correspond the template.
That is I need the result as:
<<mass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<<gross>100.100
<<net>7.7000
<
That is I need the elements have the fractional part as indicated in the xsd-schema.
May be it is possible to solve the problem by using special attributes for elements?
Thanks in Advance
Victor
|
|
|
|
|
I pretty sure you need to implement the IXmlSerializable interface to achieve what you want.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
>>I pretty sure you need to implement the IXmlSerializable interface to achieve what you want.
It seems to be that I want!
Thanks a lot!
|
|
|
|
|
I don't think the fractional parts is a requirement but a restriction. 4, 4.0, 4.00, 4.000, and 4.000 would all be valid according to the XSD schema.
If you are really picky add some attributes to the Gross property
System.Xml.Serialization.XmlElement("Gross")
System.Xml.Serialization.XmlType("decimal")
and then modify the property as required (ie return a string)
BTW, I keep saying this because I am an ass but xml elements should be camelCase.
File Not Found
|
|
|
|
|
Surely values 4, 4.0, 4.00, 4.000 would all be valid according to the XSD schema.
But I need formatting according XSD schema
Unfortunately, I can't change the type from decimal to string - type of elements must be decimal.
Thanks for help!
|
|
|
|
|
Changing the type of the property but adding the name and type attributes allows you additional formatting over the type. You can return a string and tell the serializer it is a decimal and it will believe you.
File Not Found
|
|
|
|
|
Yes! It works!
I can't change the type of the values of object Mass,
but I can add other values for serialization only.
As a result, I can use values of decimal type inside my code,
but when I need serialization I will use wrap-properties for my decimal values.
public partial class Mass<br />
{<br />
private decimal grossField;<br />
private decimal netField;<br />
<br />
[XmlIgnore]<br />
public decimal Gross<br />
{<br />
get{return this.grossField;}<br />
set{this.grossField = value;}<br />
}<br />
<br />
[XmlElement("Gross")]<br />
public string GrossAsString<br />
{<br />
get{return Utils.DecimalToString(this.grossField,3);}<br />
set{this.grossField = Convert.ToDecimal(value);}<br />
}<br />
<br />
[XmlIgnore]<br />
public decimal Net<br />
{<br />
get{return this.netField;}<br />
set{this.netField = value;}<br />
}<br />
<br />
[XmlElement("Net")]<br />
public string NetAsString<br />
{<br />
get {return Utils.DecimalToString(this.netField, 4);}<br />
set {this.netField = Convert.ToDecimal(value);}<br />
}<br />
}
public class Utils
{
private const string PATTERN = "########################################.";
public static string DecimalToString(decimal d, int precision)
{
return d.ToString(PATTERN.PadRight(PATTERN.Length + precision, '0'));
}
}
Thanks a lot!
|
|
|
|
|
d.ToString("#.0000") should work with d as a decimal
File Not Found
|
|
|
|
|
Thanks
|
|
|
|
|
I actually want to open Notepad on a remote machine.
By writing the following code, I am able to run it, but the problem is that is runs in background. I can only see it by opening up the windows task manager.
ConnectionOptions objConnectionOptions = new ConnectionOptions();<br />
objConnectionOptions.Impersonation = ImpersonationLevel.Impersonate;<br />
objConnectionOptions.EnablePrivileges = true;<br />
objConnectionOptions.Username = strUserName;<br />
objConnectionOptions.Password = strPassword;<br />
ManagementScope objManagementScope = new ManagementScope(@"\\remote-computer-name\ROOT\CIMV2", objConnectionOptions);<br />
objManagementScope.Connect();<br />
<br />
ManagementClass processClassFinal = new ManagementClass(objManagementScope, new ManagementPath("Win32_Process"), null);<br />
ManagementBaseObject inParamsFinal = processClassFinal.GetMethodParameters("Create");<br />
inParamsFinal["CommandLine"] = @"c:\windows\notepad.exe";<br />
ManagementBaseObject outParamsFinal = processClassFinal.InvokeMethod("Create", inParamsFinal, null);
Is there anyone who could help me in sorting out this problem
Thanks.
Sarfraz
|
|
|
|
|
I already told you[^] WMI cannot be used to launch a remote interactive process. It's a huge security risk.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hi,
I don no how to frame a question for this problem.
e,g.I am having two forms like fr1,fr2 and one button bt1.
through fr1 bt1 click event i wil open fr2.
my question is unless I close the fr2 i should get acees to fr1.
Pls help me..
With Regards
Prasad
|
|
|
|
|
hiremath71 wrote: my question is unless I close the fr2 i should get acees to fr1.
Instead of using fr2object.Show() method use fr2object.ShowDialog(this)
|
|
|
|
|
I'm not sure I really understood what you want, but I'll give it a try.
In case, you want the user to be able to access form1 while form2 is open, use the Show method to open form2. Otherwise use the ShowDialog method.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
I am using C# together with ASP.net.
I need to check if the screen resolution is equal or bigger than 1024 x 768, if not so, the page wil display a message that wil inform the user to change his res.
Thanks
Icarus
|
|
|
|
|
This question has better chances to be answered in the ASP.NET forum.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
I don't think this is going to work as the C# code is going to be running on the server, not the client. You need to look at one of the client side scripting technologies, like JavaScript, but I'm not sure it's possible.
The better question is why does your web app require that high of a resolution?
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|