Link to home
Start Free TrialLog in
Avatar of TheVeee
TheVeeeFlag for United States of America

asked on

NotesSql - VB example to connect and pull info

Just downloaded the NotesSql software from IBM.  Said it had programming examples, but coming up short.  I need a simple basic example of how to connect and iterate through the notes names.nsf database using Visual Basic 6.0.  I have written numerous accesses to DB2 and other facitlities, but cannot get the connect string to work.  
Avatar of HemanthaKumar
HemanthaKumar

First did you configure DSN for Notes db using ODBC ?

And test the connections ?

~Hemanth
Scripting is something similar to what you do for any regular dbms...
Avatar of TheVeee

ASKER

Yes configured the dsn and it found my Notes database.  Then drop down box was populated with necessary nsf.  Picked the names.nsf and everything seemed ok.  Have provided my snippet of code for connect....

Since posting, have got to connect, but get message base table not found - names... message
Names is the standard names.nsf everyone uses.  Additionally pointed to this in my DSN so dont understand why
it didnt find it

    ' Connect to a Database
    Set conn = CreateObject("ADODB.Connection")

'   conn.ConnectionString = "DSN=Notes1"
    conn.Open
   
    Dim szSQL As String
    szSQL = "Select LastName FROM names"
    Dim rs As ADODB.Recordset
    Set rs = New ADODB.Recordset
    rs.Open szSQL, conn, , , adCmdText   <------------- Failing here.....
    iEmpID = rs.Fields.Item(0).Value
    rs.Close
This statement is wrong...

> szSQL = "Select LastName FROM names"

You should specify a view here instead of names..eg;

 szSQL = "Select LastName FROM People"    ... This will extract field name "LastName" from the view "People"


For more details look into the notes sql help file
ASKER CERTIFIED SOLUTION
Avatar of HemanthaKumar
HemanthaKumar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TheVeee

ASKER

Once I got that principle, I was in like Flint!!  Worked awesome and its actually pretty darn easy!! Thanks for the help