Solved

Find Record in Pervasive Database with VB.Net

Posted on 2009-04-07
3
574 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
  • 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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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…

867 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now