Home All Groups Group Topic Archive Search About

Help getting data from SQL with VB 2005

Author
27 Jun 2006 2:11 PM
Arlan
Im a little new to VB 2005 and have been trying to get some data from a
SQL database.  What I want to do is get the information during
From_Load.  I have found how to setup the connection to the database
but I have no idea how to get information from it.  Here is my code so
far:


Dim sqlConn As New
SqlClient.SqlConnection("server=testDBServer;uid=XXX;pwd=XXX;database=DB1;")
        sqlConn.Open()
        Select * From VA_Data
        sqlConn.Close()

I get a line under the Select part of the code.  Can anyone tell me
what im doing wrong here?
Any and all help will be greatly appreciated!

Thanks,
Arlan

Author
28 Jun 2006 5:48 AM
Cor Ligthert [MVP]
Arlan,

Have a look at these pages, I copied the link to a frame, therefore to see
all, you should only get the first part of the link.

http://samples.gotdotnet.com/quickstart/winforms/doc/DataAccessPlaceHolder.aspx

I hope this helps,

Cor

Show quoteHide quote
"Arlan" <arla***@hotmail.com> schreef in bericht
news:1151417486.998837.326510@u72g2000cwu.googlegroups.com...
> Im a little new to VB 2005 and have been trying to get some data from a
> SQL database.  What I want to do is get the information during
> From_Load.  I have found how to setup the connection to the database
> but I have no idea how to get information from it.  Here is my code so
> far:
>
>
> Dim sqlConn As New
> SqlClient.SqlConnection("server=testDBServer;uid=XXX;pwd=XXX;database=DB1;")
>        sqlConn.Open()
>        Select * From VA_Data
>        sqlConn.Close()
>
> I get a line under the Select part of the code.  Can anyone tell me
> what im doing wrong here?
> Any and all help will be greatly appreciated!
>
> Thanks,
> Arlan
>