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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:45:06+00:00 2026-05-18T07:45:06+00:00

In the webMatrix examples, which I have working, it’s very easy to access a

  • 0

In the webMatrix examples, which I have working, it’s very easy to access a database. Only three lines are necessary to get up and going:

@{
    var db = Database.Open("LOS"); 
    var selectQueryString = "SELECT * FROM wknTest";
}

and a little later,

 @foreach(var row in db.Query(selectQueryString)){ 

There’s no using’s, no connection strings, all that happens behind the scenes. But now I have enough complicated c# code that I want to separate it into a separate C# file. How would I do the above, but in a C# file residing in the app_code folder in a webMatrix project?

  • 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-18T07:45:07+00:00Added an answer on May 18, 2026 at 7:45 am

    From scrounging around, I found I was missing the reference to one of these. I’m not sure if one or both are needed, so I’ll not mark the question answered and hopefully someone more knowledgeable than my scrounging will know.

    using WebMatrix.WebData;
    using WebMatrix.Data;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The new Webmatrix is a cool and free development environment. Does it have any
I think I may have found a bug in WebMatrix's PageData, but I am
I installed Microsoft WebMatrix, which, I believe comes with SQL Server CE4. I've tried
I know that WebMatrix does not have Pool concepts, but can I put my
I'm looking for a definitive answer to the question, Does WebMatrix have a unit
I'm playing around with WebMatrix and I'd just like to explore some of the
I'd like to return some XML instead of HTML in my WebMatrix cshtml file?
I'm trying to submit form data with jQuery. I'm using ASP.NET WebMatrix. In a
Is there any way to get intellisense with razor in VS 2010, I am
I am working on a simplistic website using PHP, a language I haven't touched

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.