Well, you won't be able to assign the node directly to the column value,
but you can use the OuterXml property of the node to get the xml to assign
to the column in string format.

Signature
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
>> Well, you can just get the xml text using the OuterXml property on the
>>XmlNode and then place that in the column using a standard insert/update
[quoted text clipped - 6 lines]
> sqlTableEntitiy(); row[xmlElementName]=xmElementText; // SQL column
> [xmlElementName] is a VarChar
lausivcid - 15 Oct 2007 21:13 GMT
> Well, you won't be able to assign the node directly to the column value,
>but you can use the OuterXml property of the node to get the xml to assign
>to the column in string format.
A DataGridView can bind an Entitiy table's columns, so I knew the
information was there somewhere. Alois Kraus
http://geekswithblogs.net/akraus1/archive/2006/02/10/69047.aspx showed
me how. Using Alois's class:
public class PropertyInvoker<T>
{
private PropertyInfo propInfo;
private object obj;
public PropertyInvoker(string PropertyName, object o)
{
obj = o;
propInfo = o.GetType().GetProperty(PropertyName);
}
public T Property
{
get
{
return (T)propInfo.GetValue(obj, null);
}
set
{
propInfo.SetValue(obj, value, null);
}
}
public T GetProperty()
{
return Property;
}
public void SetProperty(T value)
{
Property = value;
}
} // class PropertyInvoke
I can make the function
static void column<T>(string name,T value,entityType entity)
{
(new PropertyInvoker<T>(name, entity)).SetProperty(value);
}
column use:
XmlReader reader = XmlReader.Create(fn, settings);
reader.MoveToContent();
string name=null;
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
name = reader.Name;
break;
case XmlNodeType.Text:
column<string>(name,reader.Value,entity);
break;
}
}
Whether this way will be fast enough I don't know, I whll have up to
60k XML records to load per day. An improvement that I might need
to make is to use this technique to do DataGridView type binding in a
class initializer.