Jump to content

delete at sesion end from database

- - - - -

  • Please log in to reply
1 reply to this topic

#1
Endiss

Endiss

    Newbie

  • Members
  • Pip
  • 3 posts
Hi can u help me with this part of code i wanna delete whole row when session end and its not working for me idk why;/ cant use any Session[""] cuz its homework for my university;p

protected void Session_End(object sender, EventArgs e)

        {

                MyConnection.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

                int id = 2;

                try

                {

                    MyConnection.Open();

                    string deleteString = "delete from users1 where Id = '" + id + "';";

                    MyCommand.CommandText = deleteString;

                    MyCommand.Connection = MyConnection;

                    MyCommand.ExecuteNonQuery();

                }

                finally

                {

                    if (MyConnection != null)

                    {

                        MyConnection.Close();

                    }

                } 

        }

sry wrong subforum-.- can admin move to asp.net?

Edited by Endiss, 25 May 2011 - 02:04 PM.
wrong subforum xD


#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,822 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Moved.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users