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 9253943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:20:39+00:00 2026-06-18T11:20:39+00:00

I have created my connection string and it seems to be connecting without error.

  • 0

I have created my connection string and it seems to be connecting without error. I am simply trying to output the various IDs, but it’s acting like there’s nothing there!

The table is full of records… It doesn’t output any error, either. How can I even debug something like this?

Model:

namespace MvcApplication1.Models
{
    public class Directory
    {
        public int ID { get; set; }
        public bool DELETED { get; set; }
        public Guid CREATED_BY { get; set; }
        public DateTime DATE_ENTERED { get; set; }
        public Guid MODIFIED_USER_ID { get; set; }
        public DateTime DATE_MODIFIED { get; set; }
        public Guid USER_ID { get; set; }
        public Guid BRANCH_ID { get; set; }
    }

    public class MyDbContext : DbContext
    {
        public DbSet<Directory> Directories { get; set; }
    }
}

View:

@model IEnumerable<MvcApplication1.Models.Directory> 

@foreach (var item in Model) {
    <tr>
        <td>
           @item.ID
        </td>
    </tr>
}

Controller:

namespace MvcApplication1.Controllers
{
    public class HomeController : Controller
    {
        private Models.MyDbContext db = new Models.MyDbContext();

        public ActionResult Index()
        {
            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
            return View(db.Directories.ToList());
        }
    }
}
  • 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-06-18T11:20:40+00:00Added an answer on June 18, 2026 at 11:20 am

    Thanks to all for your help. I figured it out. I was using the wrong table name to start with, but then I also needed to add Database.SetInitializer<Models.MyDbContext>(null); to my global.asax…

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

Sidebar

Related Questions

I have created a customer RSA key container (for encrypting connection string in web.config)
I have created an ODBC connection for oracle using Microsoft ODBC for Oracle driver
I have created a class that will manage connection and commands, I named it
I have created a service class for my network connection so that my app
I have created an tableview that shows RSSS. I check for internet connection then
On the class level, I have created reference: System::Data::Odbc::OdbcConnection Connection; in some method I
I have created a server in java which accepts client connections. But I am
I have a collection of string. I want to create an image out of
Just random pick some methods that I have found: sforce.connection.describeSObject sforce.SearchResult sforce.sObject sforce.LeadConvert() sforce.connection.create()
I have recently changed my web app to create a database connection per command

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.