There are tons of examples that shows how to perform CRUD using ADO.NET. You just have to find them at google.
As a reference, here's a quick example:
To Insert, you can do:
protected void InsertData(){
using(SqlConnection connection = new SqlConnection("YOUR CONNECTION STRING HERE")){
string sql = "INSERT INTO YourTableName (Field1,Field2,Field3) VALUES (@Param1,@Param2,@Param3)";
using(SqlCommand cmd = new SqlCommand(sql,connection)){
cmd.Parameters.AddWithValue("@Param1", TextBox1.Text)
cmd.Parameters.AddWithValue("@Param2", TextBox2.Text)
cmd.Parameters.AddWithValue("@Param3", TextBox2.Text)
cmd.CommandType = CommandType.Text
cmd.ExecuteNonQuery()
}
}
}
To Select, you can do:
protected void FetchData(string searchText){
using(SqlConnection connection = new SqlConnection("YOUR CONNECTION STRING HERE")){
string sql = "SELECT Field1, Field2, Field3 FROM TableName WHERE YourFieldName = @Param1";
using(SqlCommand cmd = new SqlCommand(sql,connection)){
cmd.Parameters.AddWithValue("@Param1", searchText);
DataTable dt = new DataTable();
SqlDataAdapter ad = new SqlDataAdapter(cmd);
ad.Fill(dt);
if (dt.Rows.Count > 0) {
TextBox1.Text = dt.Rows[0]["Field1"].ToString();
TextBox2.Text = dt.Rows[0]["Field2"].ToString();
TextBox3.Text = dt.Rows[0]["Field3"].ToString();
}
else
{
}
}
}
}