1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| public string xmlAPI()
{
//Adresse du xml
string url = "";
XDocument xDocument = XDocument.Load(url);
var v = from g in xDocument.Descendants("").Descendants("")
select new
{
title = g.Element("id").Value,
};
String result = string.Empty;
foreach (var item in v)
{
String title = item.title;
result += title + "_";
}
return result;
}
public string connectBD(string id)
{
string connectString = "Data Source=localhost;";
SqlConnection tConnection = new SqlConnection(connectString);
tConnection.Open();
string[] listId = id.Split('_');
string sSQL = "Select * from Table where id= " + id;
SqlCommand tCommand = new SqlCommand(sSQL, tConnection);
SqlDataReader tDataReader = tCommand.ExecuteReader();
if (tDataReader.HasRows)
{
tDataReader.Read();
}
tDataReader.Close();
tConnection.Close();
?? return liste des items sélectionnés
} |