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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:16:05+00:00 2026-05-16T00:16:05+00:00

I hate to ask this question on this forum, but I’m having a lot

  • 0

I hate to ask this question on this forum, but I’m having a lot of trouble finding it on these online tutorials. Basically, I’m learning about SQL, VB.NET, and how to glue the two together, and I’ve learned about using SqlCommand.executeScalar() to get the first entry in a table. But that’s all it’s really good for, right? Or is there something more to the story here?

Basically, I’m wanting to ask about how to pull in a FULL table from a SQL database while using VB.NET, as well as how to pry substrings and stuff from it. Again I’m having to ask this on this forum because all these online tutorials seem to ignore the subject completely. Thank you for you help!

  • 1 1 Answer
  • 2 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-16T00:16:06+00:00Added an answer on May 16, 2026 at 12:16 am

    Here’s an example (a little more verbose than I like my code, but perhaps will help):


        Dim conString As String = "data source=ServerName;" & _
                                    "initial catalog=DBName;" & _
                                    "integrated security=SSPI;" & _
                                    "persist security info=false;"
    
        Dim conSQL As New SqlConnection(conString)
    
        conSQL.Open()
    
        Dim cmdSQL As New SqlCommand()
        cmdSQL.CommandType = Data.CommandType.Text
        cmdSQL.CommandText = "SELECT FieldName1, FieldName2 FROM MyTable"
    
        Dim adptSQL As New SqlClient.SqlDataAdapter(cmdSQL)
        Dim myDataSet As New DataSet()
        adptSQL.Fill(myDataSet)
    
        conSQL.Close()
    
        With myDataSet.Tables(0)
            For rowNumber As Integer = 0 To .Rows.Count - 1
                With .Rows(rowNumber)
                    Console.WriteLine(String.Format("Field1: {0}, Field2: {1}", _
                                                    .Item(0).Value.ToString, _
                                                    .Item(1).Value.ToString))
                End With
            Next
        End With
    

    Basically, one of the options SLaks mentioned above.

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

Sidebar

Related Questions

Okay I hate to ask this question ... but here goes. I am writing
I hate to ask such a general question, and this is not a write
I hate to be the third person to ask this, but the previous two
I hate ask stupid questions like this, but why doesn't my code do what
I'd hate to ask an intentionally subjective question on here, but I don't have
I hate to ask another how do you do this with regex question on
I hate to ask this, but I'm in a time crunch and I'm hoping
I hate to ask the same question others have asked in Stackoverflow, but I
I hate to ask this question as I am aware that there are plenty
I really hate to ask this question, because it seems like it's been asked

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.