Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Find Record in Pervasive Database with VB.Net

Posted on 2009-04-07
3
Medium Priority
?
591 Views
Last Modified: 2013-11-27
Hi Experts

I have a Pervasive database to which I can successfully connect and view the records, but now I would just like to Find a record in my database. Can someone please assist me with this please? I use Microsoft Visual Basic 2008

The Var TempInv_No has a integer value of "61809" but I get the Error: "Cannot perform '=' operation on System.String and System.Int32."

The same method with Access works 100% but with Pervasive it doesn't work

Thanx in Advance
Dim dr As DataRow()
        Dim con As New OleDb.OleDbConnection
        Dim ds As New DataSet
 
        Dim da As New OleDb.OleDbDataAdapter
        Dim sql As String
 
 
        cpath = "P:\HH2003"
        con.ConnectionString = "Provider=PervasiveOLEDB;Data Source=" & cpath
 
        con.Open()
        sql = "SELECT * FROM Invoices ORDER BY DocumentNumber"
        da = New OleDb.OleDbDataAdapter(sql, con)
        da.Fill(ds, "Invoices")
        con.Close()
 
            dr = ds.Tables("Invoices").Select("DocumentNumber = " & (TempInv_no))
            If Not (dr Is Nothing) AndAlso dr.Length > 0 Then
 
                MessageBox.Show("Found Invoice: " & dr(0)("DocumentNumber").ToString())
                frmInvoicing.txtInvoice.SelectAll()
                frmInvoicing.txtInvoice.Focus()
                IsinPervasive = True

Open in new window

0
Comment
Question by:Benvor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 23

Expert Comment

by:apresto
ID: 24087175
Could you post the SQL/Code you are trying to execute, sounds like a casting problem.
0
 

Author Comment

by:Benvor
ID: 24087308
SELECT * FROM Invoices ORDER BY DocumentNumber
0
 
LVL 23

Accepted Solution

by:
apresto earned 1500 total points
ID: 24087480
There is not WHERE clause in this statement, how can this be the sql you are executing to return a single record?
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question