Click here to Skip to main content
15,896,154 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionASP Menu Controls and Query Strings Pin
RB@Emphasys27-Oct-08 18:28
RB@Emphasys27-Oct-08 18:28 
QuestionHow prevent duplicate record run update statement else Insert Statement Pin
zjaffary27-Oct-08 16:58
zjaffary27-Oct-08 16:58 
AnswerRe: How prevent duplicate record run update statement else Insert Statement Pin
Kannan Ar27-Oct-08 18:56
professionalKannan Ar27-Oct-08 18:56 
AnswerRe: How prevent duplicate record run update statement else Insert Statement Pin
meeram39527-Oct-08 21:04
meeram39527-Oct-08 21:04 
AnswerRe: How prevent duplicate record run update statement else Insert Statement Pin
Michael Bookatz28-Oct-08 2:17
Michael Bookatz28-Oct-08 2:17 
QuestionJavascript Issue -Not working in Firefox Pin
Ridge Howison27-Oct-08 11:21
Ridge Howison27-Oct-08 11:21 
AnswerRe: Javascript Issue -Not working in Firefox Pin
Guffa27-Oct-08 16:12
Guffa27-Oct-08 16:12 
QuestionFormat the XML file With Asp.net Csharp Pin
zjaffary27-Oct-08 10:36
zjaffary27-Oct-08 10:36 
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:02
led mike27-Oct-08 11:02 
QuestionEdit mode in GridView changes column width Pin
Pravinc198427-Oct-08 8:52
Pravinc198427-Oct-08 8:52 
AnswerRe: Edit mode in GridView changes column width Pin
meeram39527-Oct-08 21:17
meeram39527-Oct-08 21:17 
QuestionTimeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached. Pin
AndersgRex27-Oct-08 6:40
AndersgRex27-Oct-08 6:40 
AnswerRe: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached. Pin
Rutvik Dave27-Oct-08 6:53
professionalRutvik Dave27-Oct-08 6:53 
AnswerRe: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached. Pin
AndersgRex27-Oct-08 8:31
AndersgRex27-Oct-08 8:31 
GeneralRe: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached. Pin
Ashfield27-Oct-08 9:48
Ashfield27-Oct-08 9:48 
QuestionGridView, DetailView and Creating a New Row Pin
Pravinc198427-Oct-08 6:31
Pravinc198427-Oct-08 6:31 
QuestionAJAX update panel Pin
geletaabate27-Oct-08 6:27
geletaabate27-Oct-08 6:27 
Questionvb.net and parsing xml string Pin
KingAndyb27-Oct-08 3:57
KingAndyb27-Oct-08 3:57 
QuestionNEED HELP: Runing proces using the process.start() Pin
sSupergirl27-Oct-08 2:04
sSupergirl27-Oct-08 2:04 
AnswerRe: NEED HELP: Runing proces using the process.start() Pin
SeMartens27-Oct-08 2:30
SeMartens27-Oct-08 2:30 
GeneralRe: NEED HELP: Runing proces using the process.start() Pin
sSupergirl27-Oct-08 5:54
sSupergirl27-Oct-08 5:54 
QuestionQuery String Pin
srinivaskonijeti27-Oct-08 2:00
srinivaskonijeti27-Oct-08 2:00 
AnswerRe: Query String Pin
Kannan Ar27-Oct-08 3:44
professionalKannan Ar27-Oct-08 3:44 
GeneralRe: Query String Pin
Ridge Howison27-Oct-08 11:30
Ridge Howison27-Oct-08 11:30 
QuestionGetting dataitems from a LinqDatasource/ListView in code Pin
AntoonHzn27-Oct-08 1:36
AntoonHzn27-Oct-08 1:36 

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.