>STORE SQLSTRINGCONNECT('Driver={SQL SERVER};Server=MyServer;Database=MyDatabase;uid=MyUser;pwd=MyUser'); > TO gnConnHandle >IF gnConnHandle < 0 > = MESSAGEBOX('Cannot make connection', 16, 'SQL Connect Error') >ELSE > Thisform.pConnection = gnConnHandle >ENDIF > >>
>Local tConnection >tConnection = Thisform.pConnection > >* You can use different ways to get the data – here is one using SQL Passthru > >SQLEXEC(tConnection, 'SELECT * FROM MyTable ', 'cMyTable') > >
DO WHILE .T. ME.Work() ENDDO