Click here to Skip to main content
15,887,175 members
Home / Discussions / C#
   

C#

 
Questionresources in solution Pin
nelsonpaixao27-Oct-08 13:10
nelsonpaixao27-Oct-08 13:10 
AnswerRe: resources in solution Pin
DaveyM6927-Oct-08 15:50
professionalDaveyM6927-Oct-08 15:50 
Questionthread abort exception when service ends to where it has been invoked from Pin
stephan_00727-Oct-08 13:04
stephan_00727-Oct-08 13:04 
AnswerRe: thread abort exception when service ends to where it has been invoked from Pin
Guffa27-Oct-08 15:48
Guffa27-Oct-08 15:48 
GeneralRe: thread abort exception when service ends to where it has been invoked from Pin
stephan_00727-Oct-08 23:29
stephan_00727-Oct-08 23:29 
QuestionSplitting up a list of things. Pin
Buckleyindahouse27-Oct-08 11:08
Buckleyindahouse27-Oct-08 11:08 
AnswerRe: Splitting up a list of things. Pin
Guffa27-Oct-08 11:19
Guffa27-Oct-08 11:19 
QuestionFormat The XML with Csharp Pin
zjaffary27-Oct-08 10:35
zjaffary27-Oct-08 10:35 
Hi
I have written the following asp.net page and creating the xml file through a method everything is fine it is creating the file but i have a problem. May be you can help for that. it is about the xml file output when it created it showing TABLE and TABLE1 as node in xml how i can change it to meaningful name. My Code is as follows. XML file is at the bottom of the code

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Xml;
using System.IO;

public partial class _Default : System.Web.UI.Page

{protected void Page_Load(object sender, EventArgs e){

GetEmployees("London");
}

public static void GetEmployees(string City){
//String sConnection = "server=HTCWEBDEMO;database=hometrust;user id=ht_admin;password=htc_tr!st";
String sConnection = "server=ZAFAR-PC\\SQLEXPRESS;Integrated Security=SSPI;database=northwind";
SqlConnection mySqlConnection = new SqlConnection(sConnection);

mySqlConnection.Open();

// Get the same data through the provider.
//string mySQLStatement = "SELECT Title,FirstName,LastName,PhoneNumber,Faxnumber, email from contactlist where TeamName='" + TeamName +"'; select FirstName, LastName from contactlist where TeamMorty ='True' and teamname='" + TeamName + "';";

string mySQLStatement = "SELECT FirstName,LastName,Title,City from employees where city= '" + City + "';select FirstName, LastName from employees where city='" + City + "';";

//SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter(mySQLStatement, sConnection);

SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter(mySQLStatement, sConnection);
DataSet myDataSet2 = new DataSet();
myDataSet2.DataSetName = "Contacts";
mySqlDataAdapter.Fill(myDataSet2);

// Write data to files: data1.xml and data2.xml for comparison.

myDataSet2.WriteXml("c:/temp/ContactList.xml");
mySqlConnection.Close();
}

}

XML FILE OUTPUT

<?xml version="1.0" standalone="yes" ?>
- <Contacts>
- <Table>
<FirstName>Steven</FirstName>
<LastName>Buchanan</LastName>
<Title>Sales Manager</Title>
<City>London</City>
</Table>
- <Table>
<FirstName>Michael</FirstName>
<LastName>Suyama</LastName>
<Title>Sales Representative</Title>
<City>London</City>
</Table>
- <Table>
<FirstName>Robert</FirstName>
<LastName>King</LastName>
<Title>Sales Representative</Title>
<City>London</City>
</Table>
- <Table>
<FirstName>Anne</FirstName>
<LastName>Dodsworth</LastName>
<Title>Sales Representative</Title>
<City>London</City>
</Table>
- <Table1>
<FirstName>Steven</FirstName>
<LastName>Buchanan</LastName>
</Table1>
- <Table1>
<FirstName>Michael</FirstName>
<LastName>Suyama</LastName>
</Table1>
- <Table1>
<FirstName>Robert</FirstName>
<LastName>King</LastName>
</Table1>
- <Table1>
<FirstName>Anne</FirstName>
<LastName>Dodsworth</LastName>
</Table1>
</Contacts>
AnswerCross post and Repost Pin
led mike27-Oct-08 11:03
led mike27-Oct-08 11:03 
GeneralRe: Cross post and Repost Pin
Paul Conrad27-Oct-08 12:30
professionalPaul Conrad27-Oct-08 12:30 
QuestionSpeeding up DataGridView RowCount assignment Pin
AndrusM27-Oct-08 10:10
AndrusM27-Oct-08 10:10 
AnswerRe: Speeding up DataGridView RowCount assignment Pin
Wendelius27-Oct-08 10:23
mentorWendelius27-Oct-08 10:23 
GeneralRe: Speeding up DataGridView RowCount assignment Pin
AndrusM27-Oct-08 10:28
AndrusM27-Oct-08 10:28 
GeneralRe: Speeding up DataGridView RowCount assignment Pin
Wendelius27-Oct-08 10:49
mentorWendelius27-Oct-08 10:49 
GeneralRe: Speeding up DataGridView RowCount assignment Pin
AndrusM27-Oct-08 23:53
AndrusM27-Oct-08 23:53 
GeneralRe: Speeding up DataGridView RowCount assignment Pin
Luc Pattyn27-Oct-08 10:33
sitebuilderLuc Pattyn27-Oct-08 10:33 
GeneralRe: Speeding up DataGridView RowCount assignment Pin
AndrusM27-Oct-08 22:58
AndrusM27-Oct-08 22:58 
GeneralRe: Speeding up DataGridView RowCount assignment Pin
Luc Pattyn27-Oct-08 23:28
sitebuilderLuc Pattyn27-Oct-08 23:28 
GeneralRe: Speeding up DataGridView RowCount assignment Pin
AndrusM28-Oct-08 0:09
AndrusM28-Oct-08 0:09 
GeneralRe: Speeding up DataGridView RowCount assignment Pin
Luc Pattyn28-Oct-08 0:31
sitebuilderLuc Pattyn28-Oct-08 0:31 
GeneralRe: Speeding up DataGridView RowCount assignment Pin
AndrusM28-Oct-08 3:30
AndrusM28-Oct-08 3:30 
Questionhow to make call to telephone in c# Pin
ramu20u27-Oct-08 9:21
ramu20u27-Oct-08 9:21 
AnswerRe: how to make call to telephone in c# Pin
MidwestLimey27-Oct-08 9:38
professionalMidwestLimey27-Oct-08 9:38 
AnswerRe: how to make call to telephone in c# Pin
PIEBALDconsult27-Oct-08 18:20
mvePIEBALDconsult27-Oct-08 18:20 
Questionproblem with creating a messagequeue Pin
prasadbuddhika27-Oct-08 9:10
prasadbuddhika27-Oct-08 9:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.