MS Access memo field problems 
Author Message
 MS Access memo field problems

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?



Wed, 01 Jun 2005 12:40:11 GMT  
 MS Access memo field problems
You may want to try setting the cursor location to 3 or AdUseClient.  I
suspect the query is returning too quickly.

HTH



Quote:
> 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?



Wed, 01 Jun 2005 16:04:39 GMT  
 MS Access memo field problems
On Fri, 13 Dec 2002 23:40:11 -0500, "Evan T. Basalik"

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.

...


Any suggestions?


Yes. Use the Jet OLEDB driver instead:

        Dim myConn As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=d:\My Documents\db1.mdb")

        myConn.Open()


Microsoft MVP (Visual Basic)



Fri, 03 Jun 2005 22:01:56 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Displaying MS Access fields over 255 characters (Memo fields)

2. Memo fields - problems reporting 2 memo fields

3. Updating Memo Fields in MS Access using ADO Parameter / Stored Procedures

4. Reporting Rich Text in Memo Field in MS Access

5. ms access memo field

6. MS-Access Memo Fields and Rich TextBoxs

7. Reporting Rich Text in Memo Field in MS Access

8. Handling MS Access memo fields

9. ASP page won't display text from MS Access Memo field

10. Updating Memo Fields in MS Access using ADO Parameter / Stored Procedures

11. Append memo field to a different memo field

12. Access, VB, and DAO problem with a Memo Field

 

 
Powered by phpBB® Forum Software