Solved

Using Microsoft SQL Server on VB.NET

Posted on 2006-11-15
2
194 Views
Last Modified: 2010-04-23
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.
0
Comment
Question by:Linky
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
riyazthad earned 125 total points
ID: 17952910
       Dim cn As New SqlClient.SqlConnection
        cn.ConnectionString = "Give ur connection string here"
        cn.Open()

        Dim ds As DataSet = New DataSet

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

        MyAdapter.Fill(ds)

        For each dr as DataRow in ds.tables(0).rows
              MessageBox.show(dr("field1"))
              MessageBox.show(dr("field2"))
              MessageBox.show(dr("field3"))
              'You can navigate thru all records here.    
        End For
0
 
LVL 2

Author Comment

by:Linky
ID: 17953155
Nifty. Thanks.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question