Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET SQL
now i trying web based appliaction please let me know, how to update the data from textbox to database sql, and how to delete the data from database and also check it its available or not?.
 
Please advice.....
[DELETED]@gmail.com
selvakumar v
 
[edit]Email address removed, tags set - OriginalGriff[/edit]
Posted 5-May-12 6:09am
Edited 5-May-12 6:11am
v2
Comments
OriginalGriff at 5-May-12 12:12pm
   
Never post your email address in any forum, unless you really like spam! If anyone replies to you, you will receive an email to let you know
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi ,
Check this
protected void Button1_Click(object sender, EventArgs e)
{
    using (
       SqlConnection con =
           new SqlConnection(ConfigurationManager.ConnectionStrings["testConnectionString"].ConnectionString))
    {
        con.Open();
        using (SqlCommand cmd = new SqlCommand("UPDATE dbo.cate  SET cate = @cate , chk = @chk  where id  = @id", con))
        {
            cmd.Parameters.AddWithValue("@cate", txt1.Text);
 
            cmd.Parameters.AddWithValue("@chk", chk.Checked);
 
            cmd.Parameters.AddWithValue("@id", lbl1.Text);
            cmd.ExecuteNonQuery();
        }
    }
}
Best Regards
M.Mitwalli
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

use update query
 
update tablename set columnname='value of textbox' where condition
 
--to check use if Exist keywrod in stored procedure

if Exists(Select * from tablename where condition)
Begin
  -- update query/insert query what ever you want
     insert into table name (column1,column2) values(value1,value2) 
End
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 400
1 Gihan Liyanage 238
2 Sergey Alexandrovich Kryukov 150
3 ChauhanAjay 120
4 syed shanu 110
0 Sergey Alexandrovich Kryukov 9,021
1 OriginalGriff 7,941
2 CPallini 2,603
3 Richard MacCutchan 2,121
4 Abhinav S 1,928


Advertise | Privacy | Mobile
Web03 | 2.8.140827.1 | Last Updated 6 May 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100