[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Evan T. Basalik

12/12/2002 9:18:00 PM

I am trying to run a select query against an Access 2000 table that contains
a text field, a number field, and two memo fields. As long as I leave the
memo fields out, everything does fine. If I include the memo fields, my
query returns the following error:

ERROR [07002] [Microsoft][ODBC Microsoft Access Driver] Too few parameters.
Expected 1.

I am using the ODBC.NET client in an ASP.NET application.

I am using the following code:

Dim dsChildren As New DataSet()

Dim NewRow As DataRow

Dim cmd As New Object()

Dim rdr As New Object()

Dim cn As New Object()

'Get the appropriate types based on the database type

If ConnectionString.Substring(0, 16) = "Provider=MSDASQL" Then

cmd = cmdOle

rdr = rdrOle

cn = cnOle

Else

cmd = cmdSQL

rdr = rdrSQL

cn = cnSQL

End If

'SQL - Add in "'" around ID

cmd.CommandText = "SELECT ID, Description, Code FROM CodeItems WHERE (ID = "
& ID & ")"

Debug.WriteLine(cmd.CommandText)

cmd.CommandType = CommandType.Text

cn.ConnectionString = ConnectionString

cmd.Connection = cn

If Not cn.State = ConnectionState.Open Then

Try

cn.Open()

Catch ex As SqlClient.SqlException

Debug.WriteLine(ex.Message)

Catch ex2 As System.Exception

Debug.WriteLine(ex2.Message)

End Try

End If

Try

rdr = cmd.ExecuteReader()

Catch ex As System.Exception

Debug.WriteLine(ex.Message)

Debug.WriteLine(ex.InnerException)

End Try


Any suggestions?



Evan