Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CONNX & VB.Net connecting & querying using CDD (Data Dictionary)

Status
Not open for further replies.

Bren2

Programmer
Feb 12, 2001
11
0
0
IE
Does anyone know where I could find some sample code for vb.Net. To connect to a CONNX Data Dictionary (which is build on Dibol RMS files).
I've been to the connx website, I know how to reference the "System.Data.CONNX.CNXCommand" but I have not got a clue of the code to open the connection, pass through a SQL query & cycle through the resulting recordset.
 
SOLUTION...
I eventually figured it out... But maybe it will be useful for someone else! (so I'll leave the code here)

**Note: You need to have a CONNX Data Dictionary set up.
Then using the data dictionary, create a DSN "yourDSNName".

Sample Code as follows:

Dim cnxConnection As New System.Data.CONNX.CNXConnection("DSN=yourDSNName;UID=yourUserID;PWD=yourPassword;NODE=serverIP;APPLICATION=RMS")
Dim cnxCommand As New System.Data.CONNX.CNXCommand("SELECT * FROM yourTABLE", cnxConnection)
Dim cnxReader As System.Data.CONNX.CNXDataReader
cnxConnection.Open()
cnxReader = cnxCommand.ExecuteReader

Do While cnxReader.Read = True
MessageBox.Show(cnxReader.Item("yourFieldName"))
Loop
cnxReader.Close()
cnxConnection.Close()

'* Handy Tip:
'* If you need to remap the physical RMS file dynamically in code
'* Append the following to your select query {fn setfilename <SQL Table Name>, <New File Name>}
'* (For RMS only)
'* This requires that the record structure of the new RMS file be identical to that of the previous RMS file.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top