• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 206
  • Last Modified:

Using Microsoft SQL Server on VB.NET

I am building a simple form application that needs to access my Microsoft SQL Server (I'm running 2005 Express Edition).

Alright, I've gotten to the point where I've established the connection to my Visual Basic application now I would like to do a statement like "SELECT * FROM mydb.mytable". How do I do that and what is the best way to look at the results from that query. Code would help. Thank you for the help, I realize this is an easy question for you experts but I'd like a starting point.
1 Solution
       Dim cn As New SqlClient.SqlConnection
        cn.ConnectionString = "Give ur connection string here"

        Dim ds As DataSet = New DataSet

        Dim MyAdapter As SqlClient.SqlDataAdapter
        MyAdapter  = New SqlClient.SqlDataAdapter ("select * from mytable", cn)


        For each dr as DataRow in ds.tables(0).rows
              'You can navigate thru all records here.    
        End For
LinkyAuthor Commented:
Nifty. Thanks.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now