Click here to Skip to main content
15,914,071 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to enter data (Name and Email) through web page in SQL Server database table.
I attach two text box and a submit button in my ASP.Net application design. Now I want to know the details event of Submit button.
Posted
Comments
StianSandberg 24-Jul-12 8:10am    
what have you tried?

Try this....

C#
string InsertQuery = "insert into [tablename](column1,column2) values (@param1,@param2)";
        try
        {
            SqlConObject.Open();
            SqlCommand cmd = new SqlCommand(InsertQuery, SqlConObject);
            cmd.Parameters.AddWithValue("@param1", TextName.Text.Trim());
            cmd.Parameters.AddWithValue("@param2", TextEmail.Text.Trim());
            cmd.CommandType = CommandType.Text;
            cmd.ExecuteNonQuery();
        }
        finally
        {
            SqlConObject.Close();
        }

Regards
Ashish
 
Share this answer
 
 
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