Hi mod7609
I have created sample code which fullfill requirement.
HTML
<div>
Last Modified:
<asp:Label ID="lblModified" Text="" runat="server" />
</div>
C#
private string constrg = ConfigurationManager.ConnectionStrings["constr"].ToString();
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.GetCustomers();
}
}
private void GetCustomers()
{
using (SqlConnection con = new SqlConnection(constrg))
{
using (SqlCommand cmd = new SqlCommand("SELECT max(last_user_update) last_user_update FROM sys.dm_db_index_usage_stats WHERE database_id = DB_ID( 'Test')", con))
{
DataTable dt = new DataTable();
using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
{
sda.Fill(dt);
if (dt.Rows.Count > 0)
{
lblModified.Text = dt.Rows[0]["last_user_update"].ToString();
}
}
}
}
}
Screenshot
SQL
SELECT max(last_user_update) last_user_update
FROM sys.dm_db_index_usage_stats
WHERE database_id = DB_ID( 'YOUR_DBNAME_HERE')
I hope this will works for you.