can any one tell how to insert records in sqlserver using front end asp.net with out using stored procedures in sql server.
i designed a table in asp.net with labels and text boxes with a button insert.
what code i need to write if i select insert button it should insert in a table.
Thanks
Srikanth
Christofel HakimPosted May 28, 2010, 6:56 AM
using(SqlConnection conn = new SqlConnection(your connectionstring))
{
conn.Open();
SqlCommand cmd = new SqlCommand ("INSERT INTO YourTableName (Column1) VALUES ('"+MyTexbox.Text+"'), conn);
cmd.ExecuteNonQuery();
}
if you won't working using stored procedure, why don't you use and ORM tools.
one of the easiest ORM is LINQ To SQL, an ORM built in from Microsoft.