Hello,
I am getting the contents on my website from database using SQL Stored Procedure (C#).
Now, I want to change the output look with XML / XSLT. How can I do this?
Something like this http://forums.asp.net/t/1230093.aspx/1 but am not sure how to go about it, am new to C# .NET
My sample code.
SqlConnection objConn = new SqlConnection();
objConn.ConnectionString = "server=172.16.8.444\\SQL2005;database=********;Integrated Security=false;user=********;pwd=*********;";
objConn.Open();
SqlCommand objCmd = new SqlCommand("getContent", objConn);
objCmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter result = new SqlDataAdapter(objCmd);
DataSet selectResults = new DataSet();
result.Fill(selectResults); // get dataset
objCmd.ExecuteReader();
foreach (DataRow row in selectResults.Tables[0].Rows)
{
Literal1.Text = (selectResults.Tables[0].Rows[0]["title"].ToString() + "<br />" + selectResults.Tables[0].Rows[0]["created_at"].ToString() + "<br />" + selectResults.Tables[0].Rows[0]["summary"].ToString() + "<br />" + selectResults.Tables[0].Rows[1]["title"].ToString() + "<br />" + selectResults.Tables[0].Rows[1]["created_at"].ToString() + "<br />" + selectResults.Tables[0].Rows[1]["summary"].ToString() + "<br />" + selectResults.Tables[0].Rows[2]["title"].ToString() + "<br />" + selectResults.Tables[0].Rows[2]["created_at"].ToString() + "<br />" + selectResults.Tables[0].Rows[2]["summary"].ToString());
}
<asp:Literal ID="Literal1" runat="server"></asp:Literal>