I am trying to connect to MsAccess 2000 database using ASP.NET. The code snippet is attached below. In the select statement, when I use a *, I get the values and they are populated in the drop down list. But when I use the specific column name, EMP_NAME, the page errors out
Dim comm As New OleDb.OleDbCommand
Dim strConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\Khajanchi\mdbConnect.mdb "
Dim cn As OleDbConnection = New OleDbConnection(strConnection)
Try
cn.Open()
Dim odr As OleDb.OleDbDataReader
comm.Connection = cn
comm.CommandType = CommandType.Text
comm.CommandText = "SELECT * FROM EMP"
odr = comm.ExecuteReader()
ddlSource.DataTextField = "EMP_NAME"
ddlSource.DataSource = odr
ddlSource.DataBind()
Catch err As Exception
Response.Write(err.Source)
Response.Write(err.Message)
End Try
When EMP_NAME is used in the select statement, the page errors out with
Response.Write(err.Source) = Microsoft JET Database Engine
Response.Write(err.Message) = Unknown
I upgraded MDAC to ver. 8.0, but the error remains.
Please advise
Thaniks
--
Ash - forum member
http://www.visual-basic-data-mining.net/forum