Hi, i need some help. I still new in programing (just start about a month ago).
I design a form that almost same as in Try It Out pg 581 so i just copy and paste the program and modify the connection. I also design my own sql database (using Microsoft SQL Server Express Edition with Advanced Services) and named it employees.mdf. I get an error "Incorrect syntax near the keyword 'user'" in this command line: objDataAdapter.Fill(objDataSet, "user"). user is my table in my databse. Here is the program:
Code:
' Import Data and SqlClient namespaces...
Imports System.Data
Imports System.Data.SqlClient
Public Class User
' Declare objects...
Dim objConnection As New SqlConnection _
("server=localhost\SQLExpress;database=employees;user id=MUGEN86;password=******;")
Dim objDataAdapter As New SqlDataAdapter( _
"SELECT empid, dept, fname, lname, vehmodel,plateno, hpone, email, address, city, state, zip, datereg, tagid" & _
"FROM user " & _
"JOIN employ ON user.empid = employ.empid " & _
"ORDER BY empid,lname,fname", objConnection)
Dim objDataSet As DataSet
Dim objDataView As DataView
Dim objCurrencyManager As CurrencyManager
Private Sub FillDataSetAndView()
' Initialize a new instance of the DataSet object...
objDataSet = New DataSet()
' Fill the DataSet object with data...
objDataAdapter.Fill(objDataSet, "user")
' Set the DataView object to the DataSet object...
objDataView = New DataView(objDataSet.Tables("user"))
' Set our CurrencyManager object to the DataView object...
objCurrencyManager = CType(Me.BindingContext(objDataView), CurrencyManager)
End Sub