[dba-VB] Connecting to SQL Database

David Emerson newsgrps at dalyn.co.nz
Wed Jun 6 20:58:35 CDT 2007


I am trying to learn how to retrieve data in VB.Net from a couple of 
fields from an SQL database.  Here is the code I have so far.  It is 
a combination of several different sources and playing with the auto 
completion feature of VB.Net.  I think :

             Dim conn As New SqlConnection
             conn.ConnectionString = "data source=DALYN;initial 
catalog=MLV;integrated security=SSPI;persist security info=False"
             Dim Cmd = New SqlClient.SqlCommand("SELECT ReportName, 
ParType from tblReports where ReportID = @ReportID", conn)
             Cmd.CommandType = CommandType.Text
             Cmd.Parameters.Add("@ReportID", intReport)

Where do I go from here?  I would like to put the values of 
ReportName, and ParType into variables strReportName and intParType


David Emerson
Dalyn Software Ltd
Wellington, New Zealand  

More information about the dba-VB mailing list