This is something i found that is really cool. I Always like to find the coding to do things and i found one for the GridView.
static string theConnectionString = ConfigurationManager.ConnectionStrings["MyConnectionStringSql"].ToString();
protected void Page_Load(object sender, EventArgs e)
{
BindGridView();
}
private void BindGridView()
{
SqlConnection m_objConnection = new SqlConnection(theConnectionString);
m_objConnection.Open();
SqlCommand sqlCommand = new SqlCommand("select * from Customers", m_objConnection);
SqlDataReader reader = sqlCommand.ExecuteReader();
GridView1.DataSource = reader;
GridView1.DataBind();
}
private void UpdateOrAddNewRecord(string ID, string Company, string Name, string Title, string Address, string Country, bool isUpdate)
{
SqlConnection connection = new SqlConnection(theConnectionString);
string sqlStatement = string.Empty;
if (!isUpdate)
{
sqlStatement =