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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:07:21+00:00 2026-06-12T03:07:21+00:00

I’ve seen so many ways of accessing a database using C# I don’t know

  • 0

I’ve seen so many ways of accessing a database using C# I don’t know which one is “best” for simple reading/writing/manipulating data. I used to just use generic DataSet/DataTable objects but I’m trying to use more type safe structures. I’ve started by adding a dataset (xsd) in visual studio and connecting to a SQL server backend.

I’m trying to query search a column in a table for a given string, but the column isn’t the primary key (so i can’t use .Find()). How do i do this? Do i need to use LINQ or can i use extension methods/lambda expressions?

On a more basic level, when using the design-time dataset do I need to use Table adapters to fill each table in the Dataset I use or do i just instantiate the dataset? The documentation is a bit confusing to me.

  • 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-12T03:07:22+00:00Added an answer on June 12, 2026 at 3:07 am

    You can use Linq-To-DataSet which is the most powerful way (not in terms of efficiency but in terms of readability and maintainability) to query the DataSet.

    Read more: Querying Typed DataSets.

    You have the option to create a TableAdapter or just a DataTable on the VS designer. If you add a TableAdapter VS creates also the according DataTable. If you only add a DataTable, you have to provide your own way to fill it. TableAdapters are similar to a DataAdapter in ADO.NET.

    So if you have created a DataSet named DataSet1 and added a TableAdapter which selects a table named tabData, Visual Studio will automatically create a DataTable named tabDataDataTable and a TableAdapter named tabDataTableAdapter in the namespace DataSet1TableAdapters.

    So you could fill this table in this way:

    var dataSet = new DataSet1();
    var da = new DataSet1TableAdapters.tabDataTableAdapter();
    da.Fill(dataSet.tabData);
    

    Assuming that the table has columns Name and Age and you want to find all rows where the name starts with "Jon" and age is > 30, you can use LINQ’s Where:

    var jons = dataSet.tabData
                      .Where(r => r.Name.StartsWith("Jon") && r.Age > 30);
    foreach (DataSet1.tabDataRow row in jons)
    {
        Console.WriteLine("{0} is {1} years old", row.Name, row.Age);
    }
    

    Note that you can use LINQ-To-DataSet type safe(r.Name is a string andr.Age an int).

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

Sidebar

Related Questions

I am reading a book about Javascript and jQuery and using one of the
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.