sqldatareader problem

P

poppy

I keep getting this error :
"System.Data.SqlClient.SqlException: Line 1: Incorrect
syntax near 'Name'."

Heres the code :
Sub BindData()
Dim sql As String = "Select Clientid,Client Name
from register order by Client Name"
Dim Cmd As New SqlCommand(sql, myConn)
Dim objDR As SqlDataReader
myConn.Open()
objDR = Cmd.ExecuteReader
(System.Data.CommandBehavior.CloseConnection)
Me.cboClient.DataSource = objDR
Me.cboClient.DataValueField = "EmployeeID"
Me.cboClient.DataTextField = "LastName"
Me.cboClient.DataBind()
Me.cboClient.SelectedIndex = 0
myConn.Close()
End Sub

Anyone help ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top