Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.0
Hi,
I have created the form, in that added four buttons namely Add,Edit,Delete,Block.If i'm clicking the add button the add form is diplayed.If i'm clicking Edit button the empty form is displayed for me it should open the form with all details.The same process for edit,delete and block...
 
Regards
Balamurugan
Posted 4-Oct-12 0:53am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

you can write everything is same to edit,delete but the only changes in cmd line
 
In page load you have to reterive the data's from table.
SqlCommand cmd=new SqlCommand("select * from UserCreation");
and for edit something you need to update your database with cmd as
SqlCommand cmd=new SqlCommand("update UserCreation set columnname2= '"textbox2.Text'",columnname3='"textbox3.Text'" where columnname1= '"textbox1.Text'" ");
similarly for delete something you also need to delete from database with cmd as
SqlCommand cmd=new SqlCommand("delete from UserCreation where columnname1= '"textbox1.Text'" ");
This is simple model I think you may get some ideas.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

On click of Edit button its displyainng empthy form because page is post back .so on click of Edit button u should bind your data with controls .
  Permalink  
Comments
solanki.net at 4-Oct-12 7:14am
   
can i show your code what r u writing on click of Add button ?
solanki.net at 4-Oct-12 7:32am
   
k, Now on Edit button click event u should hit database for getting result(select * from tableName) and from front end u will have to send id(id of record that u want to edit ) .according to that id u will get datatable .
then u can bind your controls with table columns.
solanki.net at 4-Oct-12 7:59am
   
same thing u will have to do .
change here only
SqlCommand cmd = new SqlCommand(" write query here for selecting data " );
sqlDataAdapter sda=new sqlDataAdapter (cmd);
DataTable dt=new DataTable();
sda.fill(dt);
then u can bind your controls
ex: textbox1.Text= dt.Rows[0][0].ToString();
Marcus Kramer at 4-Oct-12 9:58am
   
Please refrain from using textspeak in your answers. Use full words, please.

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

  Print Answers RSS
0 OriginalGriff 420
1 CHill60 410
2 Sergey Alexandrovich Kryukov 354
3 PIEBALDconsult 205
4 BillWoodruff 190


Advertise | Privacy | Mobile
Web04 | 2.8.141015.1 | Last Updated 11 Oct 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