For a website I have in my azure cloud and I work on, I need to implement a "hybrid" cache.
Meaning, my website displays a table of records from a certain db, and provides an option to either add new records or update existing ones. For the reads, I need to implement in-process cache, and for the writes (adding, updates) I need to have out-of-process cache.
I'm pretty new at C# and azure. I'll be glad to get some help to begin with...
Currently, I use simple sql commands to display, add or update:
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
GridView1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
string InsertCommand = "INSERT INTO [Students] ([Student_Name], [GPA]) VALUES (@Student_Name, @GPA)";
string connString = SqlAzureDataSource.ConnectionString;
using (SqlConnection conn = new SqlConnection(connString))
{
using (SqlCommand comm = new SqlCommand())
{
comm.Connection = conn;
comm.CommandText = InsertCommand;
comm.Parameters.AddWithValue("@Student_Name", TextBox1.Text);
comm.Parameters.AddWithValue("@GPA", TextBox2.Text);
try
{
conn.Open();
comm.ExecuteNonQuery();
this.DataBind();
}
catch (SqlException ex)
{
Console.WriteLine(ex.StackTrace);
}
}
}
}
// Similar for UPDATE
I'll appreciate any help given
Thanks