Click here to Skip to main content
11,715,165 members (77,684 online)
Rate this: bad
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.....
selvakumar v

[edit]Email address removed, tags set - OriginalGriff[/edit]
Posted 5-May-12 6:09am
Edited 5-May-12 6:11am
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
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
0 Sergey Alexandrovich Kryukov 495
1 Richard MacCutchan 275
2 Maciej Los 259
3 ManasKumarM 155
4 Frankie-C 125
0 Sergey Alexandrovich Kryukov 775
1 CHill60 415
2 Richard MacCutchan 405
3 Maciej Los 389
4 OriginalGriff 320

Advertise | Privacy | Mobile
Web01 | 2.8.150901.1 | Last Updated 6 May 2012
Copyright © CodeProject, 1999-2015
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