473,387 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How do I send Session on loop and how do I call it?P

Session Send.aspx.cs

Expand|Select|Wrap|Line Numbers
  1.  cmd.CommandText = "SELECT * FROM NewsEvents ORDER BY PostedDate DESC";
  2.  
  3.  
  4.  
  5.  
  6.         try
  7.         {
  8.             con.Open();
  9.  
  10.             SqlDataReader dr = cmd.ExecuteReader();
  11.  
  12.             int count = 0;
  13.  
  14.                while (dr.Read() && dr.HasRows)
  15.                {
  16.                    Session["id"] = dr["NewsId"].ToString();
  17.                String title=dr["NewsTitle"].ToString();
  18.                 Label1.Text +="<br><br><font size='5 px'><b>"+ dr["NewsTitle"] +"</b></font><font size='1px'>"+(dr["PostedDate"])+"</font><br><br>";
  19.                 Label1.Text += "<hr>";
  20.                 Label1.Text +=(dr["NewsShort"]).ToString().Replace(Environment.NewLine,"<br>")+"<br>";
  21.                 Label1.Text += "<a href=DetailsView.aspx>Click Here for Details</a>";
-----------------------------------------------------
SessionGet.aspx.cs
-------------------------------------------------------

Expand|Select|Wrap|Line Numbers
  1. cmd.CommandText="SELECT * FROM NewsEvents WHERE NewsId=@Sessionid";
  2.         cmd.Parameters.AddWithValue("Sessionid", Session["id"].ToString())
Nov 26 '10 #1
0 828

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: mr_burns | last post by:
Hi, i am getting the following errors when running my php script: Warning: Cannot send session cookie - headers already sent by (output started at ...
4
by: Bob | last post by:
Seem to have a problem ending a session. I get the following message. Warning: session_start(): Cannot send session cookie - headers already sent by (output started at...
3
by: lawrence k | last post by:
I'm getting this warning: PHP Warning: session_start(): Cannot send session cache limiter - headers already sent in...
19
by: lawrence k | last post by:
How can I find out where my script is outputting to the screen for the first time? My error logs are full of stuff like this: PHP Warning: session_start(): Cannot send session cache...
1
by: juergen | last post by:
Hi, there are many postings on this subject, I have read them put don't have an answer. I get these warnings: Cannot send session cookie - headers already sent in, but my php-scripts are okay. ...
14
by: bb nicole | last post by:
I using session when creaate a forum. But it display error like: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at...
4
by: three-eight-hotel | last post by:
I'm somewhat of a newbie to PHP coding, but have developed a site using the technology, and have been pleasantly surprised by the capabilities offered. I am more comfortable in the ASP world,...
4
by: nishandj | last post by:
When I use sessions in my php project I get this error Warning: session_start() : Cannot send session cache limiter - headers already sent (output started at C:\wamp\www\EzLogin\loginform.php:1)...
1
by: gipsy | last post by:
Hello, I know that you guys are familiar with this, but I tried almost every solution I googled, but no chance getting it wroked, here is the error. and here is the sessiondata.php lines,...
11
by: craigtomo | last post by:
i have changed my login .php file to the following this file is opened directly and is not called from any other file <?php // dBase file $host=""; // Host name $username=""; // Mysql...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.