connection through udl to SPSS via ODBC Data model

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

connection through udl to SPSS via ODBC Data model

Ivan-82
Hi,

I am trying to use vb net to access to a SAV to get data and information of
the variables included in the sav. To do this I use the data model that
comes with SPSS (at this very moment I am using v15). So the thing is that
using this conection I can get a dataset but from the data, here is the
code...

****************************************************************

Dim con As New OleDb.OleDbConnection()
Dim com As New OleDb.OleDbCommand()

con.ConnectionString = "Provider=mrOleDB.Provider.2;Data
Source=mrSavDsc;Persist Security Info=False;User
ID=;Location='C:\a.sav';Extended Properties=;Initial
Catalog='C:\a.sav';Mode=ReadWrite;MR Init MDSC=mrSavDsc;MR Init MDSC
Access=2;MR Init MDM Version=;MR Init MDM Language=;MR Init MDM Context=;MR
Init MDM Label Type=;MR Init MDM Access=0;MR Init MDM DataSource Use=0;MR
Init MDM Version Variable=False;MR Init Category Names=0;MR Init Category
Values=0;MR Init Allow Dirty=False;MR Init Validation=True;MR Init Input
Locale=0;MR Init Output Locale=0;MR Init Project=;MR Init Custom=;MR Init
MDM Document=;MR Init Overwrite=0;MR Init Native Schema=False"

com.Connection = con
con.Open()

Dim query As String = "select * from hdata"
com.CommandText = query
Dim dbreader As OleDb.OleDbDataReader
dbreader = com.ExecuteReader
Dim dt As New DataTable
dt.Load(dbreader)

con.Close()
****************************************************************

So this way I get a datatable with the data in the SPSS, you can use in the
query

Dim query As String = "select * from hdata" -> gets rows of data view
or
Dim query As String = "select * from vdata" -> gets columns of data view

So, my question is, is there a way to get info from the variables? I mean
labels name values etc... of course using queries and odbc like this...

I hope any of you can help me!

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD