INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

vb6 and pervasive version 9 or 8

vb6 and pervasive version 9 or 8

(OP)
i want script of vb6 to connect pervasive version 9 (9.6) or older

in database there is no username and password

kindly provide the code

 

RE: vb6 and pervasive version 9 or 8

Using VB6, you have several options for connecting to the PSQL engine.  You can use the Btrieve API, Pervasive ActiveX control, ODBC (through DAO, RDO, ADO, or ODBC API), or OLEDB (through ADO).  

You have to decide which method is best for you.  Once you've decided, you should look at the Pervasive web site (http://www.pervasivedb.com/).  They have a number of samples using those interfaces.  

If you are still having problems, post the specific problems you are having.
 

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
http://www.mirtheil.com

RE: vb6 and pervasive version 9 or 8

(OP)
Mr. Mirtheil,

Kind to you for reply on my query

I had forget to mention i want to use odbc and i had visited said web site but not finding any option to look for document/s.

i had downloaded document from this web site related

psql_v95_docs which contains 12 files as

01) Advanced_Operations_Guide
02) DDF_Builder_Users_Guide
03) Getting_Started_Server
04) Getting_Started_Workgroup
05) Products_and_Services
06) PSQL_ActiveX_Guide
07) PSQL_Addendum
08) PSQL_ADONET_Guide
09) PSQL_BtrieveAPI_Guide
10) PSQL_DTI_Guide
11) PSQL_DTO_Guide
&
12) Whats_New

respectively

but i am not ure which document to refer

if i get simple vb6 program with codeing to connect to sql and generate the crystal report 8.5 then it will be good for me as i am biginer learner of vb6 and crystal report.

waiting for the quick anticipation.

RE: vb6 and pervasive version 9 or 8

Connecting to Pervasive through ODBC in VB is the same as connecting to any database.  Here's a very simple sample:

CODE

    conn.ConnectionString = "DSN=DEMODATA"
    conn.Open
    Dim sTemp As String
    sTemp = "select * from class"
    
    Dim rs As New ADODB.Recordset
    Set rs = New ADODB.Recordset
    
    rs.CursorType = adOpenKeyset
    
    Set rs = conn.Execute(sTemp)
    
    rs.MoveFirst
    msgbox ("MoveFirst returns" & rs(0).Value)
    
    conn.Close

I don't have any code for Crystal Reports though.   

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
http://www.mirtheil.com

RE: vb6 and pervasive version 9 or 8

(OP)
Mr. Mirtheil

i heartly appreciate your work (also to community who are beginner)

following is my code in vb6 as i said i am new in this

where i am connecting to pervasive verion 8 or higher

Dim CreateDept   As Boolean
Dim GLServerName As String
Dim GLUserName   As String
Dim GLPassword   As String
Dim GLDatabase   As String
Dim GLConnection As New ADODB.Connection
Private Sub CmdClo_Click()
    Unload Me
End Sub
Private Sub cmdLogin_Click()
On Error GoTo Errhandler
    If txtDatabaseName.Text = "" Or txtServer.Text = "" Then
        MsgBox "Prduct Name <OR> Server Name <OR> Database Name cannot be empty"
    Else
        Dim str As String
        str = "Provider=PervasiveOLEDB;Data Source=" & Trim(txtServer.Text) & ";UID=" & Trim(txtLogin.Text) & ";PWD=" & Trim(txtPwd.Text) & ";Initial Catalog=" & Trim(txtDatabaseName.Text) & ""
        Dim ans As Boolean
        GLServerName = Trim(txtServer.Text)
        GLUserName = Trim(txtLogin.Text)
        GLPassword = Trim(txtPwd.Text)
        GLDatabase = Trim(txtDatabaseName.Text)
        Set GLConnection = New ADODB.Connection
        strconnect = str
        GLConnection.ConnectionString = str
        GLConnection.Open str
        ans = True
        Dim rs As New ADODB.Recordset
        strsql = "select DocumentNumber From HistoryHeader where DocumentNumber<>'' and DocumentType=3 order by DocumentNumber"
        rs.Open strsql, GLConnection, adOpenKeyset
        If rs.RecordCount > 0 Then
            Dim i As Integer
            For i = 0 To rs.RecordCount - 1
                cmbInvoice.AddItem rs!InvNumber, i
                rs.MoveNext
            Next i
        End If
    End If
    Frame1.Visible = True
     Set rs = Nothing
     cmdLogin.Enabled = False
      Exit Sub
Errhandler:
   Dim enumber As Long ' Integer
   enumber = Err.Number
   MsgBox Err.Description, vbCritical + vbOKOnly, gstrMessage
   Err.Clear
End Sub
Private Sub cmdPrint_Click()
Dim invnum As String
invnum = ""
If cmbInvoice.List(cmbInvoice.ListIndex) = "" Then
    Exit Sub
Else
    invnum = cmbInvoice.List(cmbInvoice.ListIndex)
End If
Set cmd = New ADODB.Command
cmd.ActiveConnection = GLConnection
cmd.CommandType = adCmdStoredProc
' cmd.CommandText = "[dbo].[InvDetailz]"
cmd.Parameters.Append cmd.CreateParameter("@InvNum", adVarChar, adParamInput, 20, invnum)
Set rs = cmd.Execute
Set cmd.ActiveConnection = Nothing
        Dim str As String
        str = "dsn=TEST02;uid=" & txtLogin.Text & ";pwd=" & txtPwd.Text & ";dsq=" & GLDatabase & ";"
        Dim ans As Boolean
        Set GLConnection = New ADODB.Connection
        strconnect = str
        GLConnection.ConnectionString = str
        GLConnection.CursorLocation = adUseClient
        GLConnection.Open str
        Dim Repstr As String
        Repstr = "" & GLServerName & ";" & GLUserName & ";" & GLPassword & ";DSQ=" & GLDatabase & ";"
        CrystalReport1.Connect = str ' Repstr
        CrystalReport1.ReportFileName = App.Path & "\PP_Invoice.rpt"
        CrystalReport1.WindowShowPrintBtn = True
        CrystalReport1.WindowShowPrintSetupBtn = True
        CrystalReport1.WindowState = crptMaximized
        CrystalReport1.Action = 1
        CrystalReport1.Destination = crptToWindow
        CrystalReport1.Reset
End Sub
Private Sub cmdShow_Click()
cmbInvoice.Clear
        Dim rs As New ADODB.Recordset
        strsql = "select DocumentNumber From HistoryHeader where DocumentNumber<>'' and DocumentType=3 and DocumentDate between '" & Format(DTPicker1.Value, "mm/dd/yyyy") & "' and '" & Format(DTPicker2.Value, "mm/dd/yyyy") & "' order by DocumentNumber"
        rs.Open strsql, GLConnection, adOpenKeyset
        If rs.RecordCount > 0 Then
            Dim i As Integer
            For i = 0 To rs.RecordCount - 1
                cmbInvoice.AddItem rs!InvNumber, i
                rs.MoveNext
            Next i
        End If

End Sub
Private Sub Command2_Click()
    Unload Me
    Beep
End Sub
Private Sub Form_Load()
    Frame1.Visible = False
    DTPicker2.Value = Format(DateTime.Now, "dd-MM-yyyy")
End Sub

requirement
-----------

1) how to connect to pervasive as per this code it is showing unspecified error where server name is defined as JAYESH-492A222F, User Name and Password is BLANK and Database is TEST02.

i had created DSN under ODBC as TEST02


2) how to write procedure where row has to match with different tables

select historyheader.currencycode, historylines.documentnumber, customermaster.customerdesc, currencyfile.fieldformat from historylines join historyheader on historylines.documentnumber = historyheader.documentnumber left join customermaster on historyheader.customercode = customermaster.customercode left join currencyfile on historyheader.currencycode = currencyfile.currcode where historyheader.documentnumber = @InvNum

kindly guide me to proceed further

waiting for your favourable reply

RE: vb6 and pervasive version 9 or 8

First, you have two types of connections in your code.  One has "Provider=PervasiveOLEDB" and the other has "DSN=".  You need to use on type.  You shouldn't mix methods.  I would suggest using "DSN=" rather than "provider=PervasiveOLEDB".

Second, Why do you want a stored procedure?  You've got a query.  Just use it.  You don't gain any performance by using a stored procedure.  Just remember that parameters in Pervasive use "?" rather than the "@<paramname>" notation.   

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
http://www.mirtheil.com

RE: vb6 and pervasive version 9 or 8

(OP)
as said i am new in this

can you change the code as i had tried to remove one but getting the error, so it is better u do from yr end

 

RE: vb6 and pervasive version 9 or 8

I'm not here to write your code for you. You need to decide which method to use and then apply it.  One more thing I did notice is that you have "DSQ=" in one of your connection strings.  If you are specifying a Pervasive Database name, it should be "DBQ=".  

If you want someone to fix your code, you can look into consulting services.  There are several participants in multiple forums that can do what you are looking for.  You cannot solicit consulting services here though.  You would have to contact the people directly.   

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
http://www.mirtheil.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close