Click here to Skip to main content
15,916,949 members
Home / Discussions / C#
   

C#

 
AnswerRe: Reading Specific Line Pin
Guffa27-Oct-08 21:39
Guffa27-Oct-08 21:39 
AnswerRe: Reading Specific Line Pin
Programm3r27-Oct-08 22:11
Programm3r27-Oct-08 22:11 
GeneralRe: Reading Specific Line Pin
Guffa28-Oct-08 2:21
Guffa28-Oct-08 2:21 
GeneralRe: Reading Specific Line Pin
Programm3r28-Oct-08 3:44
Programm3r28-Oct-08 3:44 
AnswerRe: Reading Specific Line Pin
PIEBALDconsult28-Oct-08 11:22
mvePIEBALDconsult28-Oct-08 11:22 
QuestionHow NOT to select a cell in DGV? Pin
User 543536427-Oct-08 19:17
User 543536427-Oct-08 19:17 
AnswerRe: How NOT to select a cell in DGV? Pin
AhsanS27-Oct-08 20:52
AhsanS27-Oct-08 20:52 
GeneralRe: How NOT to select a cell in DGV? Pin
User 543536427-Oct-08 20:54
User 543536427-Oct-08 20:54 
QuestionFreehand drawing on WPF Pin
softwareengr27-Oct-08 19:14
softwareengr27-Oct-08 19:14 
AnswerRe: Freehand drawing on WPF Pin
leppie28-Oct-08 1:14
leppie28-Oct-08 1:14 
AnswerRe: Freehand drawing on WPF Pin
Pete O'Hanlon28-Oct-08 2:32
mvePete O'Hanlon28-Oct-08 2:32 
QuestionAutomating mpp using late binding Pin
DJ24527-Oct-08 18:27
DJ24527-Oct-08 18:27 
Questioncan not connect with .xls file Pin
HowIsIT27-Oct-08 17:47
HowIsIT27-Oct-08 17:47 
AnswerRe: can not connect with .xls file Pin
Parwej Ahamad27-Oct-08 18:23
professionalParwej Ahamad27-Oct-08 18:23 
GeneralRe: can not connect with .xls file Pin
HowIsIT27-Oct-08 23:12
HowIsIT27-Oct-08 23:12 
QuestionSimple screensaver crashing Pin
Data_Dragon27-Oct-08 14:00
Data_Dragon27-Oct-08 14:00 
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 

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.