Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6772185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:31:13+00:00 2026-05-26T15:31:13+00:00

I am wondering if the following code is an old approach for working with

  • 0

I am wondering if the following code is an old approach for working with database. Or I can use more modern and productive approach?

using(SqlConnection con = new SqlConnection(Properties.Settings.Default.EventLogPrinterConnectionString))
{
    SqlCommand com = new SqlCommand("", con);

    string sql_com_sel = "";
    sql_com_sel = @"SELECT DISTINCT Users, Pages, Date FROM View_lastactiveUser WHERE (Date >= @ds AND Date <= @dp AND Pages > 0) ORDER BY Date";
    com.CommandText = sql_com_sel;
    com.Parameters.Clear();
    com.Parameters.Add("@ds", SqlDbType.DateTime).Value = ds;
    com.Parameters.Add("@dp", SqlDbType.DateTime).Value = dp;
    con.Open();
    SqlDataReader dr = com.ExecuteReader();
    while (dr.Read())
    {
        users.Add(new UserDemo() { LastActivity = dr["Date"].ToString(), Pages = int.Parse(dr["Pages"].ToString()), User = dr["Users"].ToString() });
    }
    con.Close();
    return users;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:31:13+00:00Added an answer on May 26, 2026 at 3:31 pm

    you could use LinqtoSQL or The ADO.NET Entity Framework Overview

    There are also some other solutions like nHibernate, but the first to come nativly with .NET

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering how can I allow NULL values in the following code below
I'm wondering how one could use template databinding to accomplish what the following code
I'm wondering if using the following Javascript code is reliable: if (!document.cookie) { alert('Cookies
I'm wondering if the following (pseudo) code is safe to use. I know about
I'm wondering why the following code doesn't work: String test = new String(new byte[]
In the following code $j is the jquery object. I was wondering why I
I'm wondering why this code section prints out the following: print request.user.has_perm('bug_tracking.is_developer'): + str(request.user.has_perm('bug_tracking.is_developer'))
The following code will make the View clickable, but I am wondering if this
In the following code segment, I am wondering why testvectors is not collected after
I am wondering why in the following code the static integer does not stay

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.