本文整理汇总了C#中System.Data.DataSet.ReadXmlSchema方法的典型用法代码示例。如果您正苦于以下问题:C# DataSet.ReadXmlSchema方法的具体用法?C# DataSet.ReadXmlSchema怎么用?C# DataSet.ReadXmlSchema使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.DataSet
的用法示例。
在下文中一共展示了DataSet.ReadXmlSchema方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DatasetPatrols
protected DatasetPatrols(SerializationInfo info, StreamingContext context) {
string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
if ((strSchema != null)) {
DataSet ds = new DataSet();
ds.ReadXmlSchema(new XmlTextReader(new System.IO.StringReader(strSchema)));
if ((ds.Tables["Patrols"] != null)) {
this.Tables.Add(new PatrolsDataTable(ds.Tables["Patrols"]));
}
this.DataSetName = ds.DataSetName;
this.Prefix = ds.Prefix;
this.Namespace = ds.Namespace;
this.Locale = ds.Locale;
this.CaseSensitive = ds.CaseSensitive;
this.EnforceConstraints = ds.EnforceConstraints;
this.Merge(ds, false, System.Data.MissingSchemaAction.Add);
this.InitVars();
}
else {
this.InitClass();
}
this.GetSerializationData(info, context);
System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
this.Tables.CollectionChanged += schemaChangedHandler;
this.Relations.CollectionChanged += schemaChangedHandler;
}
示例2: ArrayBinding_Load
private void ArrayBinding_Load(object sender, System.EventArgs e)
{
// Access database
System.Windows.Forms.DataVisualization.Charting.Utilities.SampleMain.MainForm mainForm = (System.Windows.Forms.DataVisualization.Charting.Utilities.SampleMain.MainForm)this.ParentForm;
// The XML document
string fileNameString = mainForm.applicationPath + "\\data\\data.xml";
string fileNameSchema = mainForm.applicationPath + "\\data\\data.xsd";
// Initializes a new instance of the DataSet class
DataSet custDS = new DataSet();
// Reads an XML schema into the DataSet.
custDS.ReadXmlSchema( fileNameSchema );
// Reads XML schema and data into the DataSet.
custDS.ReadXml( fileNameString );
// Initializes a new instance of the DataView class
DataView firstView = new DataView(custDS.Tables[0]);
Chart1.Series.Clear();
// Since the DataView implements and IEnumerable, pass the reader directly into
// the DataBindTable method with the name of the column used for the X value.
Chart1.DataBindTable(firstView, "Name");
// Set series appearance
Chart1.Series[0].ChartType = SeriesChartType.Bar;
Chart1.Series[0].Font = new Font("Trebuchet MS", 8);
Chart1.Series[0].Color = System.Drawing.Color.FromArgb(220, 224,64,10);
Chart1.Series[0].BorderWidth = 0;
}
示例3: Map_Features_DataSet
protected Map_Features_DataSet(SerializationInfo info, StreamingContext context) {
string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
if ((strSchema != null)) {
DataSet ds = new DataSet();
ds.ReadXmlSchema(new XmlTextReader(new StringReader(strSchema)));
if ((ds.Tables["Features"] != null)) {
Tables.Add(new FeaturesDataTable(ds.Tables["Features"]));
}
if ((ds.Tables["Types"] != null)) {
Tables.Add(new TypesDataTable(ds.Tables["Types"]));
}
DataSetName = ds.DataSetName;
Prefix = ds.Prefix;
Namespace = ds.Namespace;
Locale = ds.Locale;
CaseSensitive = ds.CaseSensitive;
EnforceConstraints = ds.EnforceConstraints;
Merge(ds, false, MissingSchemaAction.Add);
InitVars();
}
else {
InitClass();
}
GetSerializationData(info, context);
CollectionChangeEventHandler schemaChangedHandler = new CollectionChangeEventHandler(SchemaChanged);
Tables.CollectionChanged += schemaChangedHandler;
Relations.CollectionChanged += schemaChangedHandler;
}
示例4: Page_Load
protected void Page_Load(object sender, System.EventArgs e)
{
// Populate series data using random data
if(ChartData.Text == String.Empty)
{
double[] yValues = {23.67, 75.45, 60.45, 34.54, 85.62, 32.43, 55.98, 67.23, 56.34, 23.14, 45.24, 67.41, 13.45, 56.36, 45.29};
for(int pointIndex = 0; pointIndex < yValues.Length; pointIndex++)
{
Chart1.Series["Series1"].Points.AddXY(1990 + pointIndex, yValues[pointIndex]);
}
}
// Populate series data from the hidden text fields
else
{
DataSet dataSet = new DataSet();
dataSet.ReadXmlSchema(new StringReader(ChartDataSchema.Text));
dataSet.ReadXml(new StringReader(ChartData.Text));
DataView dataView = new DataView(dataSet.Tables[0]);
Chart1.Series["Series1"].Points.DataBindXY(dataView, "X", dataView, "Y");
}
// Data bind grid control to the series data
if (!IsPostBack)
{
DataBindGrid();
}
}
示例5: getSomeContent
private void getSomeContent()
{
dt = new DataTable();
ds = new DataSet();
String xmlpath = Server.MapPath("~/App_Data/WanhatAutot.xml");
String schemapath = Server.MapPath("~/App_Data/WanhatAutot.xsl");
ds.ReadXml(xmlpath);
ds.ReadXmlSchema(schemapath);
List<String> merkit = new List<String>();
merkit.Add("Volvo");
merkit.Add("Datsun");
merkit.Add("Nissan");
merkit.Add("Ford");
merkit.Add("Porsche");
merkit.Add("Mazda");
merkit.Add("Audi");
listMerkit.DataSource = merkit;
listMerkit.DataBind();
GridView1.DataSource = ds;
GridView1.DataBind();
}
示例6: ReadSchemaBad
private void ReadSchemaBad()
{
DataSet ds = new DataSet();
StringBuilder sb = new StringBuilder(1024);
try
{
// Read Schema File First
ds.ReadXmlSchema(AppConfig.GetEmployeesSchemaFile());
ds.ReadXml(AppConfig.GetEmployeesBadFile());
foreach (DataRow dr in ds.Tables[0].Rows)
{
sb.AppendFormat("id={0}", dr["id"]);
sb.AppendFormat(Environment.NewLine);
sb.AppendFormat("FirstName={0}", dr["FirstName"]);
sb.AppendFormat(Environment.NewLine);
sb.AppendFormat("LastName={0}", dr["LastName"]);
sb.AppendFormat(Environment.NewLine);
}
txtResult.Text = sb.ToString();
}
catch (Exception ex)
{
txtResult.Text = ex.ToString();
}
}
示例7: ReadDataSet
internal static DataSet ReadDataSet()
{
DataSet ds = new DataSet();
ds.ReadXmlSchema("store.xsd");
ds.ReadXml("store.xml");
return ds;
}
示例8: GenerateTypedDataSet
internal string GenerateTypedDataSet(XmlSchemaElement element, XmlSchemas schemas, CodeNamespace codeNamespace, StringCollection references, CodeDomProvider codeProvider)
{
if (element == null)
{
return null;
}
if (this.importedTypes[element.SchemaType] != null)
{
return (string) this.importedTypes[element.SchemaType];
}
IList list = schemas.GetSchemas(element.QualifiedName.Namespace);
if (list.Count != 1)
{
return null;
}
XmlSchema schema = list[0] as XmlSchema;
if (schema == null)
{
return null;
}
DataSet dataSet = new DataSet();
using (MemoryStream stream = new MemoryStream())
{
schema.Write(stream);
stream.Position = 0L;
dataSet.ReadXmlSchema(stream);
}
string name = new TypedDataSetGenerator().GenerateCode(dataSet, codeNamespace, codeProvider.CreateGenerator()).Name;
this.importedTypes.Add(element.SchemaType, name);
references.Add("System.Data.dll");
return name;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:32,代码来源:DataSetSchemaImporterExtension.cs
示例9: GetInnerText
//public static XmlNodeList GetXmlNodes(string xmlNodePath)
//{
// XmlDocument xmlDoc = new XmlDocument();
// //xmlDoc.Load();
// return xmlDoc.SelectNodes(xmlNodePath);
//}
/*
public static string GetInnerText(string xmlNodePath)
{
XmlDocument xmlDoc = new XmlDocument();
LoadXMLSettingsFile(xmlDoc, GetSettingsFile());
XmlNode xmlNode = xmlDoc.SelectSingleNode(xmlNodePath);
return xmlNode.InnerText;
}
*/
public static DataSet GetDataSet(string DataSetSchemaPath, string TableXmlPath)
{
DataSet ds = new DataSet();
ds.ReadXmlSchema(DataSetSchemaPath);
ds.ReadXml(TableXmlPath);
return ds;
}
示例10: ConvertXMLFileToDataSet
private static DataSet ConvertXMLFileToDataSet(string xmlFile)
{
StringReader stream = null;
XmlTextReader reader = null;
try
{
XmlDocument xmld = new XmlDocument();
xmld.Load(xmlFile);
DataSet xmlDS = new DataSet();
stream = new StringReader(xmld.InnerXml);
//从stream装载到XmlTextReader
reader = new XmlTextReader(stream);
//xmlDS.ReadXml(reader);
xmlDS.ReadXmlSchema(reader);
//xmlDS.ReadXml(xmlFile);
return xmlDS;
}
catch (System.Exception ex)
{
throw ex;
}
finally
{
if (reader != null)
reader.Close();
}
}
示例11: GetProducts
public static DataTable GetProducts()
{
DataSet dsStore = new DataSet();
dsStore.ReadXmlSchema(Application.StartupPath + "\\store.xsd");
dsStore.ReadXml(Application.StartupPath + "\\store.xml");
return dsStore.Tables["Products"];
}
示例12: Form1_Load
private void Form1_Load(object sender, EventArgs e)
{
// Приязка к таблицам в качестве источника BindingSource
dgwDrivers.DataSource = bsDrivers;
dgwCars.DataSource = bsCars;
// BindingSource - предназначен для упрощения процесса
// привязки элементов управления к источнику данных
// Создание DataSet с именем AutoPark
dataSet = new DataSet("AutoPark");
// Формирование заполнение dataSet из XML-файла
dataSet.ReadXml("Registration.xml");
dataSet.ReadXmlSchema("Registration.xsd");
// присваивание dataSet объекту BindingSource
bsDrivers.DataSource = dataSet;
// указываем таблицу для свойства DataMember
bsDrivers.DataMember = "Drivers";
// присваивание dataSet объекту BindingSource
bsCars.DataSource = bsDrivers;
// указываем таблицу для свойства DataMember
bsCars.DataMember = "FK_DriversCars";
}
示例13: DS2
protected DS2(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) :
base(info, context, false) {
if ((this.IsBinarySerialized(info, context) == true)) {
this.InitVars(false);
System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
this.Tables.CollectionChanged += schemaChangedHandler1;
this.Relations.CollectionChanged += schemaChangedHandler1;
return;
}
string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
if ((this.DetermineSchemaSerializationMode(info, context) == System.Data.SchemaSerializationMode.IncludeSchema)) {
System.Data.DataSet ds = new System.Data.DataSet();
ds.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
this.DataSetName = ds.DataSetName;
this.Prefix = ds.Prefix;
this.Namespace = ds.Namespace;
this.Locale = ds.Locale;
this.CaseSensitive = ds.CaseSensitive;
this.EnforceConstraints = ds.EnforceConstraints;
this.Merge(ds, false, System.Data.MissingSchemaAction.Add);
this.InitVars();
}
else {
this.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
}
this.GetSerializationData(info, context);
System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
base.Tables.CollectionChanged += schemaChangedHandler;
this.Relations.CollectionChanged += schemaChangedHandler;
}
示例14: dsItem
protected dsItem(SerializationInfo info, StreamingContext context)
{
string s = (string) info.GetValue("XmlSchema", typeof(string));
if (s != null)
{
DataSet dataSet = new DataSet();
dataSet.ReadXmlSchema(new XmlTextReader(new StringReader(s)));
if (dataSet.Tables["Item"] != null)
{
base.Tables.Add(new _ItemDataTable(dataSet.Tables["Item"]));
}
base.DataSetName = dataSet.DataSetName;
base.Prefix = dataSet.Prefix;
base.Namespace = dataSet.Namespace;
base.Locale = dataSet.Locale;
base.CaseSensitive = dataSet.CaseSensitive;
base.EnforceConstraints = dataSet.EnforceConstraints;
base.Merge(dataSet, false, MissingSchemaAction.Add);
this.InitVars();
}
else
{
this.InitClass();
}
base.GetSerializationData(info, context);
CollectionChangeEventHandler handler = new CollectionChangeEventHandler(this.SchemaChanged);
base.Tables.CollectionChanged += handler;
base.Relations.CollectionChanged += handler;
}
示例15: Generate
public static string Generate (string inputFileContent, CodeCompileUnit compileUnit, CodeNamespace mainNamespace, CodeDomProvider codeProvider)
{
var dataSet = new DataSet ();
dataSet.ReadXmlSchema (inputFileContent);
T.Generate (dataSet, mainNamespace, codeProvider.CreateGenerator ());
return null;
}