Eviews to Access

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

Maxm
Posts: 1
Joined: Wed Feb 08, 2012 7:50 am

Eviews to Access

Postby Maxm » Wed Feb 08, 2012 8:00 am

I am having trouble establishing a link from Eviews to Access.

Dim cmdpat As ADODB.Connection
Dim cmdGetDB As ADODB.Command
Dim cmdDBParam As ADODB.Parameter
Dim rst As ADODB.Recordset
Dim eviewsstr, connstr As String
On Error GoTo ErrorHandler

Set cmdpat = New ADODB.Connection
connstr = "Provider=EviewsOleDbProvider.EviewsProv;" & _
"Path=c:\recessions.wf1; Include ID Series=False"
cmdpat.Open connstr

Set cmdGetDB = New ADODB.Command
Set cmdGetDB.ActiveConnection = cmdpat
eviewsstr = "@date gdpr_1 @smpl @all"
cmdGetDB.CommandText = eviewsstr

Set rst = cmdGetDB.Execute()

The eviewsstr takes on a value of 188 when I run the program but the recordset always turns up empty. Any help would be appreciated.

Thanks!

EViews Steve
EViews Developer
Posts: 844
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

Re: Eviews to Access

Postby EViews Steve » Wed Feb 08, 2012 9:20 am

I tried to do the same thing on my own workfile and it seemed to work fine. I assume gdpr_1 is a series?

Here's my code (written for VB.NET using Visual Studio 2008 and Microsoft ActiveX Data Objects 2.8 ) :

Code: Select all

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim cmdpat As ADODB.Connection Dim cmdGetDB As ADODB.Command Dim rst As ADODB.Recordset Dim eviewsstr, connstr As String cmdpat = New ADODB.Connection connstr = "Provider=EViewsOleDbProvider.EViewsProv;" & _ "Path=c:\files\tq.wf1; Include ID Series=False" cmdpat.Open(connstr) cmdGetDB = New ADODB.Command cmdGetDB.ActiveConnection = cmdpat eviewsstr = "@date gdpf @smpl @all" cmdGetDB.CommandText = eviewsstr rst = cmdGetDB.Execute() Dim liCount As Integer = 0 Dim lsData As String = "" While Not rst.EOF liCount += 1 For Each fld As ADODB.Field In rst.Fields lsData = lsData & fld.Value & vbTab Next rst.MoveNext() lsData = lsData & vbCrLf End While MsgBox(lsData) cmdpat.Close() End Sub

EViews Steve
EViews Developer
Posts: 844
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

Re: Eviews to Access

Postby EViews Steve » Wed Feb 08, 2012 9:33 am

Just did the same thing in Access 2007 (using Microsoft ActiveX Data Objects 2.8 ) :

Code: Select all

Option Compare Database Public Sub test() Dim cmdpat As ADODB.Connection Dim cmdGetDB As ADODB.Command Dim rst As ADODB.Recordset Dim eviewsstr, connstr As String Set cmdpat = New ADODB.Connection connstr = "Provider=EviewsOleDbProvider.EviewsProv;" & _ "Path=c:\files\tq.wf1; Include ID Series=False" cmdpat.Open connstr Set cmdGetDB = New ADODB.Command Set cmdGetDB.ActiveConnection = cmdpat eviewsstr = "@date gdpf @smpl @all" cmdGetDB.CommandText = eviewsstr Set rst = cmdGetDB.Execute() Dim liCount As Integer liCount = 0 Dim lsData As String lsData = "" While Not rst.EOF liCount = liCount + 1 For i = 0 To rst.Fields.Count - 1 lsData = lsData & rst.Fields(i).Value & vbTab Next rst.MoveNext lsData = lsData & vbCrLf Wend MsgBox lsData cmdpat.Close End Sub


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests