Configuring a DB Connection

Results 1 to 3 of 3

Thread: Configuring a DB Connection

  1. #1
    Join Date
    Dec 1969

    Default Configuring a DB Connection

    I&#039;m new to .net and pulling examples off the web and experimenting. I&#039;m into Database stuff now but don&#039;t understand when using the statements below the .net environment hightlights the SQLConnection on line 1 below and states that "Type SQL connection not defined". I get the same message with SQLCommand and SQLDataReader. I&#039;ve got the imports for both and Can I not just copy and paste examples into my project or do I have to drag components from the toolbox onto the form as well? <BR><BR><BR> Dim myConnection As New SQLConnection("Server=localhost;Database=pubs;UID= sa;PWD=;")<BR> myConnection.Open()<BR><BR> Dim strSQL As String = "select * from authors order by au_lname"<BR> Dim myCommand As New SQLCommand(strSQL, myConnection)<BR><BR> Dim myDataReader As SQLDataReader<BR> myDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConne ction)

  2. #2
    Join Date
    Dec 1969

    Default Good link

    Introduction to ASP.NET Data Access<BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default RE: Configuring a DB Connection

    Put this above the "Public Class Webform1" text in your code behind page, put it at the very top.<BR>so it should look like..<BR><BR><BR>Imports System.Data<BR>Imports System.Data.SqlClient<BR><BR>Public Class WebForm1<BR>&#039;code<BR><BR>End Class

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts