Advertisement
Advertisement
| 08.19.2008 at 03:31AM PDT, ID: 23659024 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
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: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: |
public static void UpdateXML()
{
SqlConnection myConnection = new SqlConnection(Configuration.DbConnectionString);
SqlCommand cmd = new SqlCommand("SELECT newsticker_Text, newsticker_Status, newsticker_DateAdded FROM tbl_newsticker WHERE newsticker_Status = 'True'", myConnection);
cmd.CommandType = CommandType.Text;
SqlDataReader datareader = null;
try
{
// Open the connection
myConnection.Open();
// Create the datatable and the datatable row
DataTable datatable = new DataTable("item");
DataRow datarow;
datareader = cmd.ExecuteReader();
if (datareader != null && datareader.Read())
{
// Columns
datatable.Columns.Add("header");
datatable.Columns.Add("date");
while (datareader.Read())
{
// Rows
datarow = datatable.NewRow();
string strText = Utilities.Db_Output((string)datareader["newsticker_Text"]);
DateTime dtDate = Convert.ToDateTime(datareader["newsticker_DateAdded"]);
string strDate = Convert.ToString(dtDate.Day + "/" + dtDate.Month + "/" + dtDate.Year);
datarow[0] = strText;
datarow[1] = strDate;
datatable.Rows.Add(datarow);
}
}
else
{
// Columns
datatable.Columns.Add("header");
datatable.Columns.Add("date");
// Rows
datarow = datatable.NewRow();
string strText = "There are currently no news headlines.";
DateTime dtDate = DateTime.Now;
string strDate = Convert.ToString(dtDate.Day + "/" + dtDate.Month + "/" + dtDate.Year);
datarow[0] = strText;
datarow[1] = strDate;
datatable.Rows.Add(datarow);
}
// Create the dataset
DataSet dataset = new DataSet("newsTicker");
dataset.Tables.Add(datatable);
dataset.GetXml();
// Output the xml
string strPath = HttpContext.Current.Server.MapPath("~/Data/ticker.xml");
dataset.WriteXml(strPath);
}
finally
{
try
{
if (datareader != null)
{
// Close the data reader
datareader.Close();
}
// Close the connection
myConnection.Close();
}
catch (SqlException)
{
// handle the exception
throw;
}
}
}
|