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

Reply via email to