After trying and getting completely frustrated last August, I gave up on SQL Server and continued using the Access database.
Now I'm going to try again. The code I tried today, to complete the execise on page 572 and which results in this error:
An error occurred creating the form. See Exception.InnerException for details. The error is: Keyword not supported: 'sqlserver databases;database'.
Since SQLServer Databases is the name of the folder that contains the Pubs database, I'm lost.
Here's the latest version of my code, which results in the above error:
Code:
Public Class Form1
Dim objConnection As New SqlConnection _
("server=localhost\SQLEXPRESS;Integrated Security=TRUE;SQLServer Databases;database=PUBS")
Dim objDataAdapter As New SqlDataAdapter
Dim objDataSet As New DataSet
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Set the SelectCommand properties...
objDataAdapter.SelectCommand = New SqlCommand
objDataAdapter.SelectCommand.Connection = objConnection
objDataAdapter.SelectCommand.CommandText = _
"Select au_lname, au_fname, title, price " & _
"FROM authors " & _
"JOIN titleauthor ON authors.au.id = titleauthor.id " & _
"JOIN titles ON titleauthor.title_id = titles.title_id " & _
"ORDER BY au_lname, au_fname"
objDataAdapter.SelectCommand.CommandType = CommandType.Text
'Open the database connection...
objConnection.Open()
'Fill the DataSEt object with data...
objDataAdapter.Fill(objDataSet, "authors")
'Close the database connection...
objConnection.Close() '
'Set theDataGridView properties to bind it to our data...
grdAuthorTitles.AutoGenerateColumns = True
grdAuthorTitles.DataSource = objDataSet
grdAuthorTitles.DataMember = "authors"
'Clean up
objDataAdapter = Nothing
objConnection = Nothing
End Sub
Can anyone point me in the right direction so that I can understand how the programs( both in development and the users)?
Milt