Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,
I am doing a web based GUI.Whose front end is ASP.NET.The screen has many controls such as dropdown,textbox etc.When a perticular parameter in the dropdown is selected its current settings should be saved in the data base.So i need C# code for the save button.Please guide me..m new to C#

Regards
Posted

C#
SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=Your Database Name;Integrated Security=True");
           con.Open();
           SqlCommand command= new  SqlCommand();
           command.Connection = con;
           command.CommandType = CommandType.Text;
           command.CommandText = "your query here"


           try
           {
               command.ExecuteNonQuery();
               con.Close();


           }

           catch (Exception e)
           {

           }
 
Share this answer
 
See code for save button[^]. All your questions of this sort are useless.

See also: C# code for the update button[^].

—SA
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900