Re: querying access tables

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Miha Markic [MVP C#] (miha)
Date: 09/20/04


Date: Mon, 20 Sep 2004 16:45:12 +0200

Why the heck you use adodb in first place?
What does the error say when run from ado.net?

-- 
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
"Jochen Becker" <f.j.becker@t-online.de> wrote in message 
news:cimq18$gvo$06$1@news.t-online.com...
> Hallo everybody,
> the problem goes as follows:
> Running a data query to an ACC2000 database from Visual VB or C# using a
> WHERE clause is always successful when using DAO, it fails (sometimes) 
> when
> using ADODB or ADO.NET. Testing various tables and Queries revealed that 
> the
> failure always occurs if the conditions in the WHERE clause contain a
> reference to a table field of the combobox type where the data are drawn
> from another table.
> I have not found any hint to solve this problem( e.g. MSDN kB etc.) and 
> all
> my attemps have failed this far.
>
> I have attached at the end one (ADODB) example of many unsuccessful 
> attempts
>
> The error occurs when rec.open(..) is executed.
> Using ADO.NET the analogous error occurs when executing
> reader = cmd.ExecuteReader()
>
> All the various test codes run fine when no WHERE clause was included or
> only fields w/o combo box where addressed in the clause
>
> Who has an idea to overcome this?
>
> Many thnaks for your help in advance
>
> Jochen
> -----------------------------------------------
>
> Imports ADODB
>
> Imports System.Data.OleDb
>
> Imports System.Diagnostics
>
> Dim DbSource As String
>
> Dim dbs As New ADODB.Connection
>
> Dim rec As New ADODB.Recordset
>
> Dim dbname, dbadresse, strSQL As String
>
> Dim TimeWindow, CT, LT
>
> Dim FeldWert As Object, FeldWert1 As Object
>
> DbSource = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
> Replace(dbname, "\", "\\")
>
> strSQL = "SELECT * FROM Preise where preise.Zone='Fern'"
>
> rec.Open(strSQL, dbs, CT, LT, 0)
>
> rec.MoveFirst()
>
> While Not rec.EOF
>
> FeldWert = rec.Fields("zone").Value
>
> MsgBox(FeldWert.ToString)
>
> rec.MoveNext()
>
> End While
>
> rec.Close()
>
> dbs.Close()
>
> ------------------------------------------------------
>
> Error message (translated)
>
> A not treated exception of  type
> 'System.Runtime.InteropServices.COMException' occured in AdressenADO.exe.
>
> Additional info: unknown error
>
>
>
> 


Relevant Pages

  • querying access tables
    ... Running a data query to an ACC2000 database from Visual VB or C# using a ... WHERE clause is always successful when using DAO, ... I have attached at the end one (ADODB) example of many unsuccessful attempts ... Dim dbs As New ADODB.Connection ...
    (microsoft.public.dotnet.framework.adonet)
  • RE: Parameter Query Error - Expression is too complex to be evalua
    ... I'm trying to evaluate the returned value in the Where clause (see ... Jerry Whittle, Microsoft Access MVP ... Dim LatRad1 As Single ... AS "Distance from Center" ...
    (microsoft.public.access.queries)
  • Re: IN in query
    ... In the case implying a single table, no join involved, any WHERE clause is applicable to data in ONE record of the table at a time. ... Dim qdf As DAO.QueryDef ... Dim strCategory As String ... Set qdf = db.QueryDefs ...
    (microsoft.public.access.queries)
  • RE: Still having probs with SQL and Variables...
    ... Dim stas String ... you could also create a short loop to load all table field names ... I can't seem to get the WHERE clause to refer to the value stored ...
    (microsoft.public.access.queries)
  • Re: lstBox Record Set wont change
    ... Dim T_Visit As String ... missing the space between the WHERE clause and the ORDER ... ReasonForVisitTest, "") ...
    (microsoft.public.access.formscoding)