Hi,
I need help PLEASE.
I tried to pull information from two tables, the two tables have relationship of many to many and there is third table " relationship table" between the two tables.
So I connected to the database and I connection string works good, but when execution reaches this fragment of code "objdataAdapte.fil (objDataSet, "tableName")I get ERROR message that says
"
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll"
Dim objConnection As SqlConnection = New SqlConnection("seRver=(local);database=pubs;Integr ated Security=SSPI;user id=Oner;password=xxxxxxxxx;")
Dim objDataAdapter As SqlDataAdapter = New SqlDataAdapter("SELECT authors_id, au_fname, au_lname, " & _
"titles.title_id, title, price " & _
"FROM authors " & _
"JOIN titleauthor ON authors.au_id = titleauthor.au_id " & _
"JOIN titles ON titleauthor.title_id = titles.title_id " & _
"ORDER BY au_lname, au_fname", objConnection)
Dim objDataSet As DataSet
Dim objDataView As DataView
Dim objCurrencyManager As CurrencyManager
THEN I CALL THIS CODE AT FORM LOAD EVENT
Private Sub FillDataSetAndView()
'initialize the new Instance of the Dataset Object
objDataSet = New DataSet()
'Fill the DataSet with data
objDataAdapter.Fill(objDataSet, "authors")
'set the dataview Object to the DataSet object ....
objDataView = New DataView(objDataSet.Tables("authors"))
'Set the CurrencyManager object to the DataView
objCurrencyManager = CType(Me.BindingContext(objDataView), CurrencyManager)
NOTE: I COPIED THIS CODE STRAIGHT FROM
VB BOOK.
AND REMEMBER I AM PULLING THE INFORMATION FROM TWO TABLES BUT I'M POPULATING THE DATASET WITH ONE TABLE IS THAT BROBLEM?
THANKS AND ANY HELP IS REALLY APPRECIATED.