Click here to Skip to main content
15,906,106 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how i store data in database sql server
Posted
Comments
Sampath Kumar Sathiya 28-Dec-12 5:21am    
Could you please provide some detail about what you want exactly?
Oleksandr Kulchytskyi 28-Dec-12 5:23am    
Which exact data you want to store in DB???

1 solution

Try:
C#
using (SqlConnection con = new SqlConnection(strConnect))
    {
    con.Open();
    using (SqlCommand com = new SqlCommand("INSERT INTO myTable (myColumn1, myColumn2) VALUES (@C1, @C2)", con))
        {
        com.Parameters.AddWithValue("@C1", myValueForColumn1);
        com.Parameters.AddWithValue("@C2", myValueForColumn2);
        com.ExecuteNonQuery();
        }
    }
 
Share this answer
 
Comments
ridoy 28-Dec-12 6:16am    
simple and efficient..+5

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