Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Data;
- using System.Data.SqlClient;
- using System.Text;
- public partial class userinfo : System.Web.UI.Page
- {
- SqlConnection scon = new SqlConnection(@"User id=sa;Password=123;Server=.\sqlexpress03;Database=event");
- StringBuilder htmlTable = new StringBuilder();
- protected void Page_Load(object sender, EventArgs e)
- {
- string a = Session["username"].ToString();
- using (SqlCommand scmd = new SqlCommand())
- {
- scmd.Connection = scon;
- scmd.CommandType = CommandType.Text;
- scmdselect.Parameters.Add("@Username", SqlDbType.VarChar, 50).Value = Username;
- scmd.CommandText = "SELECT * FROM registered where username = @a";
- scon.Open();
- SqlDataReader articleReader = scmd.ExecuteReader();
- htmlTable.Append("<table border='1'>");
- htmlTable.Append("<tr><th>SlNo.</th><th>Name</th><th>Mobile Number</th><th>EmailId</th></tr>");
- if (articleReader.HasRows)
- {
- while (articleReader.Read())
- {
- htmlTable.Append("<tr>");
- htmlTable.Append("<td>" + articleReader["userid"] + "</td>");
- htmlTable.Append("<td>" + articleReader["username"] + "</td>");
- htmlTable.Append("<td>" + articleReader["email"] + "</td>");
- htmlTable.Append("<td>" + articleReader["createddate"] + "</td>");
- htmlTable.Append("</tr>");
- }
- htmlTable.Append("</table>");
- PlaceHolder1.Controls.Add(new Literal { Text = htmlTable.ToString() });
- articleReader.Close();
- articleReader.Dispose();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement