Ok but I am using Mysql too in my application if I use that I am getting an error as
*Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.* On Wed, Apr 11, 2012 at 1:32 PM, Taleeb Anwar <[email protected]> wrote: > Ok. Here's what I guess is happening. You are making changes in you db file > which is stored inside your bin directory. When there is a change in the > bin directory* the App pool recycles *and thus you loose the session > variable. > > There must be several ways of avoiding it - perhaps the following will work > In your web.config add the following > > <configuration> > <system.web> > <sessionState mode="StateServer"></sessionState> > </system.web> > </configuration> > > Hope it helps... > > Thanks & Regards > Taleeb Anwar > > *Hai Ab bhi Tera "Shwarma" Afsana Khwan Humara!!* > > > > > On Tue, Apr 10, 2012 at 6:26 PM, Dorababu Meka <[email protected]> > wrote: > > > Yeah on Inserting or Updating the session is getting *NULL* > > > > On Tue, Apr 10, 2012 at 6:25 PM, Taleeb Anwar <[email protected]> > > wrote: > > > > > Of course the value will not be inserted - but just wanted to make sure > > > that the problem is occurring on insertion..! > > > > > > Thanks & Regards > > > Taleeb Anwar > > > > > > *Hai Ab bhi Tera "Shwarma" Afsana Khwan Humara!!* > > > > > > > > > > > > > > > On Tue, Apr 10, 2012 at 6:23 PM, Dorababu Meka <[email protected]> > > > wrote: > > > > > > > How Can I insert data in to the table if I comment that line as per > you > > > > said.. > > > > > > > > Session value exists if I comment that line.. > > > > > > > > On Tue, Apr 10, 2012 at 6:20 PM, Taleeb Anwar <[email protected] > > > > > > wrote: > > > > > > > > > Though I don't know much about .NET...still > > > > > > > > > > Try the following > > > > > Comment the execute non query. Now Click on button 1 (no values > will > > be > > > > > inserted) and then on button 2. Is session value retained or lost? > > > > > > > > > > Thanks & Regards > > > > > Taleeb Anwar > > > > > > > > > > *Hai Ab bhi Tera "Shwarma" Afsana Khwan Humara!!* > > > > > > > > > > > > > > > > > > > > > > > > > On Tue, Apr 10, 2012 at 5:40 PM, Dorababu Meka < > [email protected]> > > > > > wrote: > > > > > > > > > > > This is my code that I have written in .Net > > > > > > > > > > > > protected void Page_Load(object sender, EventArgs e) > > > > > > { > > > > > > > > > > > > if (!IsPostBack) > > > > > > { > > > > > > Session["x"] = "session value"; // assigning Session > > > > > > } > > > > > > } > > > > > > > > > > > > My code to insert data to the Database is as follows > > > > > > > > > > > > protected void Button1_Click(object sender, EventArgs e) > > > > > > { > > > > > > string path = Server.MapPath("bin/sampldb.db"); > > > > > > SQLiteConnection conn = new SQLiteConnection("Data > Source=" > > + > > > > path > > > > > > + ""); > > > > > > try > > > > > > { > > > > > > conn.Open(); > > > > > > SQLiteCommand cmd = new SQLiteCommand(); > > > > > > cmd.Connection = conn; > > > > > > string txt = "insert into stu values(" + > TextBox1.Text + > > > > ",'" > > > > > + > > > > > > TextBox2.Text + "')"; > > > > > > cmd.CommandType = CommandType.Text; > > > > > > cmd.CommandText = txt; > > > > > > cmd.ExecuteNonQuery(); > > > > > > conn.Close(); > > > > > > > > > > > > } > > > > > > catch (Exception ex) > > > > > > { > > > > > > Label1.Visible = true; > > > > > > Label1.Text = "Error:" + ex.Message; > > > > > > } > > > > > > } > > > > > > > > > > > > My code to test whether Session exists or not after Inserting > data > > is > > > > as > > > > > > follows > > > > > > > > > > > > protected void Button2_Click(object sender, EventArgs e) > > > > > > { > > > > > > if (Session["x"] != null) // Here after Inserting data > and > > > > > > clicking on the next button available my Session value is getting > > > Null > > > > > > { > > > > > > Label1.Visible = true; > > > > > > Label1.Text = Session["x"].ToString(); > > > > > > } > > > > > > } > > > > > > > > > > > > This is the over all code I have written in my application > > > > > > > > > > > > On Tue, Apr 10, 2012 at 5:35 PM, TeDe <[email protected]> wrote: > > > > > > > > > > > > > Am 10.04.2012 11:17, schrieb Dorababu Meka: > > > > > > > > Hi I am using SQLLITE database in my .net application. > > > > Unfortunately > > > > > > if I > > > > > > > > perform any operation like Insert and performing other > > operations > > > > > like > > > > > > > > getting data from database my Session which was assigned > before > > > is > > > > > > > getting * > > > > > > > > NULL.* Is this a bug or what, have you fixed this in later > > > > versions, > > > > > if > > > > > > > so > > > > > > > > please let me know. > > > > > > > > > > > > > > > > I am using Visual Studio 2010.. > > > > > > > > > > > > > > > We have been using System.Data.SQLite for many years, without > > major > > > > > > > bugs. So its unlikely you found one. Instead the way you are > > using > > > > the > > > > > > > Framework might be somehow erroneous. > > > > > > > > > > > > > > If you ask these kind of questions, please post some lines of > > > > relevant > > > > > > > code. With such an unspecific information, nobody is able to > help > > > > you. > > > > > > > > > > > > > > Thomas > > > > > > > _______________________________________________ > > > > > > > sqlite-users mailing list > > > > > > > [email protected] > > > > > > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > *Thanks & Regards,* > > > > > > ** > > > > > > *M.Dorababu* > > > > > > ** > > > > > > ** > > > > > > _______________________________________________ > > > > > > sqlite-users mailing list > > > > > > [email protected] > > > > > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > > > > > > > > > _______________________________________________ > > > > > sqlite-users mailing list > > > > > [email protected] > > > > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > > > > > > > > > > > > > > > > > > > -- > > > > *Thanks & Regards,* > > > > ** > > > > *M.Dorababu* > > > > ** > > > > ** > > > > _______________________________________________ > > > > sqlite-users mailing list > > > > [email protected] > > > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > > > > > _______________________________________________ > > > sqlite-users mailing list > > > [email protected] > > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > > > > > > > > > -- > > *Thanks & Regards,* > > ** > > *M.Dorababu* > > ** > > ** > > _______________________________________________ > > sqlite-users mailing list > > [email protected] > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > _______________________________________________ > sqlite-users mailing list > [email protected] > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- *Thanks & Regards,* ** *M.Dorababu* ** ** _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

