Click here to Skip to main content
15,899,474 members
Home / Discussions / C#
   

C#

 
AnswerRe: Convert Console Application C# sharp Method Pin
zjaffary25-Oct-08 3:05
zjaffary25-Oct-08 3:05 
GeneralRe: Convert Console Application C# sharp Method Pin
Fayu12-Nov-08 15:46
Fayu12-Nov-08 15:46 
QuestionResuming a download stream Pin
Fayu24-Oct-08 8:57
Fayu24-Oct-08 8:57 
AnswerRe: Resuming a download stream Pin
Ennis Ray Lynch, Jr.24-Oct-08 9:10
Ennis Ray Lynch, Jr.24-Oct-08 9:10 
GeneralRe: Resuming a download stream Pin
Fayu24-Oct-08 9:13
Fayu24-Oct-08 9:13 
GeneralRe: Resuming a download stream Pin
Ennis Ray Lynch, Jr.24-Oct-08 9:22
Ennis Ray Lynch, Jr.24-Oct-08 9:22 
AnswerResolution: Pin
Fayu24-Oct-08 19:13
Fayu24-Oct-08 19:13 
AnswerRe: Resuming a download stream Pin
zjaffary25-Oct-08 3:06
zjaffary25-Oct-08 3:06 
Thanks for your reply. I have done what i was trying to do. But now have another issue. 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>
GeneralRe: Resuming a download stream Pin
Guffa25-Oct-08 3:16
Guffa25-Oct-08 3:16 
QuestionPrint error from CaptureAndPrintMSChart project [modified] Pin
ATC24-Oct-08 8:40
ATC24-Oct-08 8:40 
QuestionCapture Screen problem Pin
Xmen Real 24-Oct-08 8:09
professional Xmen Real 24-Oct-08 8:09 
Questionsizing editor Pin
netJP12L24-Oct-08 7:26
netJP12L24-Oct-08 7:26 
Questiondisplaying proxyAddresses attribute on a AD account Pin
lane0p224-Oct-08 5:30
lane0p224-Oct-08 5:30 
AnswerRe: displaying proxyAddresses attribute on a AD account Pin
Parwej Ahamad24-Oct-08 7:40
professionalParwej Ahamad24-Oct-08 7:40 
QuestionCan't set HorizontalScroll.Visible attribute Pin
Alan Balkany24-Oct-08 5:19
Alan Balkany24-Oct-08 5:19 
AnswerRe: Can't set HorizontalScroll.Visible attribute Pin
DaveyM6924-Oct-08 5:57
professionalDaveyM6924-Oct-08 5:57 
GeneralRe: Can't set HorizontalScroll.Visible attribute Pin
Luc Pattyn24-Oct-08 6:46
sitebuilderLuc Pattyn24-Oct-08 6:46 
GeneralRe: Can't set HorizontalScroll.Visible attribute Pin
Alan Balkany24-Oct-08 7:08
Alan Balkany24-Oct-08 7:08 
GeneralRe: Can't set HorizontalScroll.Visible attribute Pin
DaveyM6924-Oct-08 7:42
professionalDaveyM6924-Oct-08 7:42 
GeneralRe: Can't set HorizontalScroll.Visible attribute Pin
Alan Balkany24-Oct-08 7:47
Alan Balkany24-Oct-08 7:47 
GeneralRe: Can't set HorizontalScroll.Visible attribute Pin
Giorgi Dalakishvili24-Oct-08 8:18
mentorGiorgi Dalakishvili24-Oct-08 8:18 
GeneralRe: Can't set HorizontalScroll.Visible attribute Pin
Luc Pattyn24-Oct-08 9:15
sitebuilderLuc Pattyn24-Oct-08 9:15 
GeneralRe: Can't set HorizontalScroll.Visible attribute Pin
Giorgi Dalakishvili24-Oct-08 9:22
mentorGiorgi Dalakishvili24-Oct-08 9:22 
Question[Message Deleted] Pin
tozy24-Oct-08 4:01
tozy24-Oct-08 4:01 
AnswerRe: Hello plz help i am new in creating excel app by using c# Pin
Thomas Stockwell24-Oct-08 4:11
professionalThomas Stockwell24-Oct-08 4:11 

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.