Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

C# Programming

delete a row in a sql databse


i want to delete a selected row from the database.the entries of
database is shown by a gridview and i do
<OnRowDeleting="GridView1_RowDeleting"> in source code.

i select and bind as follows.
[mycode]

string str = "select PNR,CreditCardNumber as 'Credit Card
Number',EmalAddress as 'Email Address',PassengerName as 'Passenger
Name',PassportNumber as 'Passport Number',IPNumber as 'IP Number' from
fraud_db order by PNR";
        dbconn dc = new dbconn();

        SqlConnection myConnection = new SqlConnection("Data
Source=IT0004493;Initial Catalog=IBE_fraud;User ID = sa ; password =
ecomtest ");//Trusted_Connection = yes;
        myConnection.Open();
        SqlCommand myCommand = new SqlCommand(str, myConnection);
        SqlDataReader myReader = myCommand.ExecuteReader();

        GridView1.DataSource = myReader;
        GridView1.DataBind();

        myReader.Close();
        myConnection.Close();

[mycode]

now when i click on delete link it calls GridView1_RowDeleting(object
sender, GridViewDeleteEventArgs e) method

can i get the row entries of that row (i mean values of that row )
inside that method? i suppose to delete the row from db using that
entries of row using the query delete * from db where ....
(there is no primaty key in the table.)
is there any other easy way to delete a row from db selected in
gridview.

please help me.

i want to delete a selected row from the database.the entries of
database is shown by a gridview and i do
<OnRowDeleting="GridView1_RowDeleting"> in source code.

i select and bind as follows.
[mycode]

string str = "select PNR,CreditCardNumber as 'Credit Card
Number',EmalAddress as 'Email Address',PassengerName as 'Passenger
Name',PassportNumber as 'Passport Number',IPNumber as 'IP Number' from
fraud_db order by PNR";
        dbconn dc = new dbconn();

        SqlConnection myConnection = new SqlConnection("Data
Source=IT0004493;Initial Catalog=IBE_fraud;User ID = sa ; password =
ecomtest ");//Trusted_Connection = yes;
        myConnection.Open();
        SqlCommand myCommand = new SqlCommand(str, myConnection);
        SqlDataReader myReader = myCommand.ExecuteReader();

        GridView1.DataSource = myReader;
        GridView1.DataBind();

        myReader.Close();
        myConnection.Close();

[mycode]

now when i click on delete link it calls GridView1_RowDeleting(object
sender, GridViewDeleteEventArgs e) method

can i get the row entries of that row (i mean values of that row )
inside that method? i suppose to delete the row from db using that
entries of row using the query delete * from db where ....
(there is no primaty key in the table.)
is there any other easy way to delete a row from db selected in
gridview.

please help me.

-----------------------------------------------Reply-----------------------------------------------

i want to delete a selected row from the database.the entries of
database is shown by a gridview and i do
<OnRowDeleting="GridView1_RowDeleting"> in source code.

i select and bind as follows.
[mycode]

string str = "select PNR,CreditCardNumber as 'Credit Card
Number',EmalAddress as 'Email Address',PassengerName as 'Passenger
Name',PassportNumber as 'Passport Number',IPNumber as 'IP Number' from
fraud_db order by PNR";
        dbconn dc = new dbconn();

        SqlConnection myConnection = new SqlConnection("Data
Source=IT0004493;Initial Catalog=IBE_fraud;User ID = sa ; password =
ecomtest ");//Trusted_Connection = yes;
        myConnection.Open();
        SqlCommand myCommand = new SqlCommand(str, myConnection);
        SqlDataReader myReader = myCommand.ExecuteReader();

        GridView1.DataSource = myReader;
        GridView1.DataBind();

        myReader.Close();
        myConnection.Close();

[mycode]

now when i click on delete link it calls GridView1_RowDeleting(object
sender, GridViewDeleteEventArgs e) method

can i get the row entries of that row (i mean values of that row )
inside that method? i suppose to delete the row from db using that
entries of row using the query delete * from db where ....
(there is no primaty key in the table.)
is there any other easy way to delete a row from db selected in
gridview.

please help me.

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc