Click here to Skip to main content
13,456,800 members
Rate this:
Please Sign up or sign in to vote.
See more:
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.....
selvakumar v

[edit]Email address removed, tags set - OriginalGriff[/edit]
Posted 5-May-12 6:09am
Updated 5-May-12 6:11am
OriginalGriff 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
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))
        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);

Best Regards
Rate this: bad
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)
  -- update query/insert query what ever you want
     insert into table name (column1,column2) values(value1,value2) 

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.180322.1 | Last Updated 6 May 2012
Copyright © CodeProject, 1999-2018
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