|
You could try using a compiler that doesn't punish good programmers for using perfectly legitimate code. Technically, there is no conflict so long as the outer scope lenum comes after the inner scope one. MS's csc and Mono's mcs both use this buggy scoping, however DotGNU Portable.NET's cscc allows this code (as well it should) since there is no conflict. It does reject code where the outer scope variable is declared before the inner scope variable, however (since in that case there is an actual conflict).
Rich
P.S. For more info on DotGNU check out: http://www.dotgnu.org/
|
|
|
|
|
Here's the deal: I have created an XSD file that relates back to an XML data file. The XML data is EMPTY (no data), only the XML Header, DataSet name and reference to the XSD file comprise the contents of the XML (see below):
<?xml version="1.0" encoding="utf-8" ?>
<MyDataSet> xmlns="http://tempuri.org/MyDataFile.xsd">
</MyDataSet>
I load this XML file into a DataSet object using ReadXML() with the ReadSchema parm. While the XML data file is empty, this read statement succeeds just fine; expected this, it's all good.
Now, I want to add a 'record' into the XML file, so I need to create a new DataTable, but I want to use the schema that's already defined in the XSD for my table (makes sense). In my schema (XSD) file, this record is defined as MyDataRecord (if I view the Schema in designer, I can see the datastructure just fine).
Becase the XML file is empty, doing something like:
DataTable dt = MyDataSet.Tables["MyDataRecord"];
only returns NULL
I thought, perhaps, I could do the following:
DataTable dt = MyDataSet.Tables.Add();
and it would be "smart enough" to create a DataTable object using the schema datastructure, but it does not ...
I need to know how to create a DataTable object of type "MyDataRecord " so I have the complete data structure ...
There has GOT to be a simple way to do this, someone please enlighten me.
TIA.
D.
|
|
|
|
|
How do you load your Dataset?It should be like this:
XmlDataDocument doc = new XmlDataDocument();
doc.DataSet.ReadXmlSchema("schema.xsd");
doc.Load("mydataset.xml");
After this you can get your tables in dataset.
Mazy
No sig. available now.
|
|
|
|
|
I create a DataSet and use ReadXML("mydatafile.xml", XmlReadMode.ReadSchema);
It's loading the schema just fine, but as I stated, since the XML file is empty, essentially the DataSet contains no valid tables in it's Table Collection.
So how do I go about creating a DataTable that has the datastucture defined in the schema?
D.
|
|
|
|
|
|
Ok,
what you suggested did not work, since a DataAdapter in itself is an Abstract class, but it reminded me of an example I downloaded a while back that used a 'pre-canned' xml/xsd file ...
The only difference between that example, and my code, is that they have you drop a DataSet object on your Window in the Form Designer window and bind it to a "typed dataset" ... which I did ...
Now this seems to be working(?)
I'm not sure what the difference is between creating a DataSet object programmically and attaching it to my schema and what's taking place when I do this visually ...
Obviously something is being 'set' somewhere that either I am missing, or doing wrong.
Perhaps someone knows the answer to this question? I'd still like to know how to make this all happen in code.
D.
|
|
|
|
|
D,
If you want to peek under the hood, maybe taking a look to .cs file generated by your .xsd may shed some light on the issue.
On the other hand, if you want to test the FillSchema solution, use a SqlDataAdapter, I gave you the wrong link
eperales
|
|
|
|
|
Hey,
I checked the CS files in the generated code section, but I'll be #%&* if I can figure out what the differences were/are, between the generated code and what I had done programmically ... obviously there's something because it works now.
Thank you for the information and taking the time to respond.
D.
|
|
|
|
|
Is there an easy way to clone a DataTable?
*->>Always working on my game, teach me
*->>something new.
cout << "dav1d\n";
|
|
|
|
|
DataRow[] sourceRows=sourceTable.Select();
DataTable targetTable=sourceTable.Clone();
foreach(DataRow sourceRow in sourceRows)
targetTable.ImportRow(sourceRow);
eperales
|
|
|
|
|
what is s1ck about that is that I just clone the table without its rows; all I need is the schema.
Thanks E.
*->>Always working on my game, teach me
*->>something new.
cout << "dav1d\n";
|
|
|
|
|
DataSet ds;<br />
ds.Clone();
From MSDN:
DataSet.Clone Method
Copies the structure of the DataSet, including all DataTable schemas, relations, and constraints. Does not copy any data.
[C#]
[Serializable]
public virtual DataSet Clone();
Return Value
A new DataSet with the same schema as the current DataSet, but none of the data.
|
|
|
|
|
Hello:
I am trying to develop a sink that will intercept the constructor and destruction messages for my remoted objects on the server side so I can track the performance.
I know I have to use the following code, but am unsure on how to continue?
Please Advise!!!!
<br />
public class TrackerSink : IMessage<br />
{<br />
IMessageSink _nextSink;<br />
<br />
public TrackerSink(IMessageSink nextSink)<br />
{<br />
_nextSink = nextSink;<br />
}<br />
<br />
#region IMessage Members<br />
<br />
public System.Collections.IDictionary Properties<br />
{<br />
get<br />
{<br />
return null;<br />
}<br />
}<br />
<br />
#endregion<br />
<br />
public IMessage SyncProcessMessage(IMessage msg) <br />
{<br />
return _nextSink.SyncProcessMessage(msg);<br />
}<br />
<br />
public IMessageCtrl AsyncProcessMessage(IMessage msg, IMessageSink replySink) <br />
{<br />
return _nextSink.AsyncProcessMessage(msg,replySink);<br />
}<br />
<br />
public IMessageSink NextSink <br />
{<br />
get <br />
{<br />
return _nextSink;<br />
}<br />
}<br />
}<br />
|
|
|
|
|
OK, Is there anyone out there who has any idea of how to do this??? I have asked this question on multiple boards and multiple times. Research has lead me to only knowing that the constructor and destructor messages are communicated with the IMessage interface, but I have no clue on how to implement this. PLEASE, someone help!!!!!
|
|
|
|
|
I guess that this idea is something that hasn't been approached or not by anyone here. Thank you if you tried to research the issue, but I am not going to move on to a new approach since I have searched in vain for this answer.
|
|
|
|
|
using System;<br />
using System.Runtime.Remoting;<br />
using System.Runtime.Remoting.Channels;<br />
using System.Runtime.Remoting.Channels.Tcp;
error: C:\Visual Studio Projects\Server\Class1.cs(4): The type or namespace name 'Tcp' does not exist in the class or namespace 'System.Runtime.Remoting.Channels' (are you missing an assembly reference?)
i'm trying to follow a tutorial which uses this namespace, but it doesn't appear to exist.
when is type: using System.Runtime.Remoting.Channels.
i get no drop down for any other options.. and when i manually just force it in, i get a compile error that the tcp methods dont' exist.
can anyone help?
|
|
|
|
|
Mike,
You have to add a reference to System.Runtime.Remoting to your project.
|
|
|
|
|
thank you! i thought i could just call it.
|
|
|
|
|
I'm developing an application on the Compact .Net platform in C#, and I am wondering what the best strategy is for setting up multiple forms. Should my child forms simply be controls on a main form as in the IBuySpy sample, or should I set up actual System.Windows.Form forms for my sub forms? Or, should I set up each form as a separate project altogether? I do need to share a database amongst the forms, so I may be restricted on how independent the forms can be. Any thoughts?
|
|
|
|
|
In my windows app, I am referencing a web service. Now the web service moved, do I need to recompile my windows app. Is there a way where I can set a configuration file or something where the next time it moves I can just cahnge on file instead of compiling the whole component.
|
|
|
|
|
The webservice object has a URL property.
You should be able to use this to do what you require.
Cheers,
Simon
sig :: "Don't try to be like Jackie. There is only one Jackie.... Study computers instead.", Jackie Chan on career choices.
article :: animation mechanics in SVG picture :: my first abstract photo
|
|
|
|
|
I am developing a web application that displays information in a datagrid. As users navigate the data, the datagrid redisplays new data. I am running into a problem when the users us the back button in their browser and the datagrid getting out of sync. How can I keep this information in sync? What techniques are used to synchronize this information? Thanks in advance.
|
|
|
|
|
Hi Folks,
Is there an easy way in C# to get the \Documents and Settings\CurrentUser\Application Data folder path?
Thanks
Davy
My Personal Blog - Homepage. Scottish News - Angus Blog, Perth Blog and Dundee Blog
|
|
|
|
|
Application.CommonAppDataPath or Application.LocalUserAppDataPath
Also this shell method do it:
SHGetSpecialFolderLocation()
Mazy
No sig. available now.
|
|
|
|
|