Welcome, Guest
Username: Password: Remember me
This public forum is meant for questions and discussions about Visual FoxPro
  • Page:
  • 1

TOPIC:

SqlExec() is alive!!!! 23 Apr 2020 01:08 #14154

  • FoxProMatt
  • FoxProMatt's Avatar
  • Topic Author



What a great day!! I installed ver 2.4, and the first thing I did was test SqlExec(). Ka-boom! Works like a charm! Good work X# team.

This code will look very familiar to any VFP coder:
.


FUNCTION TestSqlQuery AS VOID

	VAR connString = "driver={Sql Server}; server=192.168.X.XX\SQLEXPRESS; database=XXXX; uid=XXXX; pwd=XXXX;"
	VAR nHandle = SqlStringConnect(connString)
	
	VAR cSql = "Select * From Customers Order by CustomerNo"
	
	VAR nResult = SqlExec(nHandle, cSql, "csrSqlQuery1")

	FIELD CustomerNo, Company  && Add this to make compiler happy when we reference field names in Scan statement.

	SCAN 
	  ? CustomerNo + ": " + Company 
	ENDSCAN

ENDFUNC

Please Log in or Create an account to join the conversation.

Last edit: by FoxProMatt.
  • Page:
  • 1