From: Erk on
Hello all. For years I have programmed in VO (and previously Clipper)
and always used the DBF databases (.CDX and NTX) for my applications.
My main reasons to use VO are the variety of functions and the easyness
to manipulate data from our end-systems (Windows Server, AS400, etc)
into a DBF database for the user. However, in the past I have had some
occassions that our DBF Database had become corrupt and for this reason
(and because I'am interested to learn more....!!) I would like to learn
more on how I can work with .SQL databases in VO (how to
create/maintain them). I wonder if and where I can find the necessary
documentation about implementing SQL in VO applications. There are not
a lot of books for VO available but maybe (.... I hope), as starting
point, someone can provide me with a simple .AEF in which the base
database functions are included (creating, deleting and updating a
record). Can someone help me with this? Are there also specific points
of concern when starting to use SQL in VO?

Kind rgds,
Rob

From: Willie Moore on
Rob,

What version of VO do you have? If you have 2.7, you can use VO2ADO. It is
on the CD. There are samples included with it to show how to use the
recordset classes. It is a very well though out class library. There are
quite a few of us on here who use the VO2AD classes. I am more than willing
to answer questions.

Regards,

Willie


"Erk" <erk.v(a)hotmail.com> wrote in message
news:1168191872.704995.43710(a)s34g2000cwa.googlegroups.com...
> Hello all. For years I have programmed in VO (and previously Clipper)
> and always used the DBF databases (.CDX and NTX) for my applications.
> My main reasons to use VO are the variety of functions and the easyness
> to manipulate data from our end-systems (Windows Server, AS400, etc)
> into a DBF database for the user. However, in the past I have had some
> occassions that our DBF Database had become corrupt and for this reason
> (and because I'am interested to learn more....!!) I would like to learn
> more on how I can work with .SQL databases in VO (how to
> create/maintain them). I wonder if and where I can find the necessary
> documentation about implementing SQL in VO applications. There are not
> a lot of books for VO available but maybe (.... I hope), as starting
> point, someone can provide me with a simple .AEF in which the base
> database functions are included (creating, deleting and updating a
> record). Can someone help me with this? Are there also specific points
> of concern when starting to use SQL in VO?
>
> Kind rgds,
> Rob
>


From: Erk on

Willie,

I'am using VO 2.7 (I think it is the Professional version. Need to
check this in the office tomorrow) so will have a look at the CDRom.
Just some questions:

1) are you creating a SQL database on the SQL server or within VO 2.7?
2) does VO 2.7 work properly with the latest version of SQL Server? Is
this Windows SQL
2005?
3) I will build up my own SQL Server (at home) to start working with
VO. Assume the standard
build of the SQL Server is sufficient or do I need to add certain
Windows components on the
SQL server so that it runs fine with VO?

Sorry for the simple questions.....

Thks,
Rob

From: Ginny Caughey on
Rob,

If you're looking for a free SQL database to start working with, I'd suggest
downloading SQL Express. It has a GUI management tool called SQL Server
Management Studio that you can use to create and manage your databases.
Alternatively you can create them programmatically using VO2Ado. There are
wrappers in VO2Ado that allow you to create, update and delete records, but
if this is new work rather than old VO code you're migrating, I'd suggest
just learning the SQL syntax to do these things. Any good book on SQL will
get you started.

--
Ginny


"Erk" <erk.v(a)hotmail.com> wrote in message
news:1168191872.704995.43710(a)s34g2000cwa.googlegroups.com...
> Hello all. For years I have programmed in VO (and previously Clipper)
> and always used the DBF databases (.CDX and NTX) for my applications.
> My main reasons to use VO are the variety of functions and the easyness
> to manipulate data from our end-systems (Windows Server, AS400, etc)
> into a DBF database for the user. However, in the past I have had some
> occassions that our DBF Database had become corrupt and for this reason
> (and because I'am interested to learn more....!!) I would like to learn
> more on how I can work with .SQL databases in VO (how to
> create/maintain them). I wonder if and where I can find the necessary
> documentation about implementing SQL in VO applications. There are not
> a lot of books for VO available but maybe (.... I hope), as starting
> point, someone can provide me with a simple .AEF in which the base
> database functions are included (creating, deleting and updating a
> record). Can someone help me with this? Are there also specific points
> of concern when starting to use SQL in VO?
>
> Kind rgds,
> Rob
>


From: diskbit on

1. My server SQL ( Mysql or Mssql or MsAcces )

2. Example Serwer MsAcces SQL

3. Create File DataBase MsAcces c:\mysample.mdb


4. Start->Settings->Control Panel-> Administrative Tools -> Data
Sources ODBC ->System DNS
- Add
- Select Microsoft Acces-Treiber(*.mdb)
- Data Source Name: MYSAMPLEACCES
- Clic group Database: [ Select .. ]
- Select c:\mysample.mdb
- Clic [ OK ]

5. Run ca-vo 2.5 or 2.7

- New Aplication Standart Mdi SQL

- Create in module start :
GLOBAL oLinkSQL AS OBJECT

GLOBAL MyNameODBC := "MYSAMPLEACCES" AS STRING
GLOBAL MyUserODBC := "Admin" AS STRING
GLOBAL MyPaswordODBC := "" AS STRING


- Cerate Module MyFunctionSQL

6. 1-Function

//===================================
//
//===================================
FUNCTION fLinkSQL () AS LOGIC
LOCAL LogicFunction := TRUE AS LOGIC

oLinkSQL := NULL_OBJECT
oLinkSQL := SQLConnection{}
IF .not. ( oLinkSQL : connect( MyNameODBC , MyUserODBC ,
MyPaswordODBC )
LogicFunction := FALSe
ENDIF
RETURN LogicFunction

//===================================
//
//===================================

FUNCTION finLinkSQL () AS LOGIC
LOCAL LogicFunction := TRUE AS LOGIC

oLinkSQL :Disconnect()
IF .not. ( oLinkSQL :Disconnect() )
LogicFunction := FALSe
ENDIF

oLinkSQL := NULL_OBJECT

RETURN LogicFunction

//===================================
//
//===================================


FUNCTION CreateTable01SQL () AS LOGIC
LOCAL LogicFunction := TRUE AS LOGIC
LOCAL TxtSQL := "" as STING
LOCAL ObSql , Ob AS OBJECT

ObSql := SQLConnection{}
IF !( obSql : Connect( MyNameODBC , MyUserODBC , MyPaswordODBC )
)
LogicFunction:=FALSE
endif

if LogicFunction == TRUE
TxtSQL := 'SELECT TOP 2 * FROM My01Table '
ob := SQLStatement{TxtSQL,obSql}
IF ob:Execute()
LogicFunction:=FALSE
endif
Endif


if LogicFunction == TRUE
obSql :Disconnect()
obSql := NULL_OBJECT
ObSql := SQLConnection{}
IF !( obSql : Connect( MyNameODBC , MyUserODBC , MyPaswordODBC
) )
LogicFunction:=FALSE
endif
Endif

if LogicFunction == TRUE
TxtSQL := ""
TxtSQL := TxtSQL + "CREATE TABLE My01Table ( IDok AUTOINCREMENT
CONSTRAINT MyFieldConstraint PRIMARY KEY , "
TxtSQL := TxtSQL + "NAME01 VARCHAR(40) NULL , "
TxtSQL := TxtSQL + "NAME02 VARCHAR(40) NULL , "
TxtSQL := TxtSQL + "NUM INT NULL , "
TxtSQL := TxtSQL + "KEYNO VARCHAR(20) NULL , "
TxtSQL := TxtSQL + "INFO LONGTEXT NULL ) "

&& ---------------------------------------------
ob:=SQLStatement{TxtSQL,obSql}
IF !ob:Execute()
LogicFunction:=FALSE
ENDIF
&& ---------------------------------------------
Endif


if LogicFunction == TRUE
TxtSQL := ""
TxtSQL := "CREATE INDEX KEYNO ON My01Table ( KEYNO )"
ob:=SQLStatement{TxtSQL,obSql}
IF !ob:Execute()
LogicFunction:=FALSE
Endif
ENDIF

if LogicFunction == TRUE
obSql:Disconnect()
endif

obSql:=NULL_OBJECT

RETURN LogicFunction

/////
add record
1/

METHOD ???????
LOCAL LogicFunction := TRUE AS LOGIC
LOCAL ObSql , Ob , ObSelect AS OBJECT
Local MyKeyNo:="ABCEF" AS STRING
Local MyIDNo :=0 as INT


ObSql := SQLConnection{}
IF !( obSql : Connect( MyNameODBC , MyUserODBC , MyPaswordODBC ) )
LogicFunction:=FALSE
endif

TxtSQL := "INSERT INTO My01Table ( KEYNO ) VALUES ( '"+MyKeyNo+ ) '"

Ob := SQLStatement{TxtSQL,ObSql}
IF !Ob:Execute()
LogicFunction:=FALSE
Endif

if LogicFunction == TRUE
TxtSQL := "SELECT * FROM My01Table WHERE ( KEYNO = '"+MyKeyNo+"'
) "
ObSelect := NULL_OBJECT
ObSelect :=SQLSelect{ TxtSQL , ObSql } && ||
&&- - - - - - - - - - - - - - - - - - - - - -
ObSelect : Gotop()
IF !(ObSelect:Eof)
IF !( ObSelect:KEYNO == NIL )
IF ( Alltrim(ObSelect:KEYNO) == MyKeyNo )

MyIDNo := ObSelect:IDok
ObSelect:NAME01 := "JAN "
ObSelect:NAME02 := "ADAM "
ENDIF
ENDIF
ENDIF
&&- - - - - - - - - - - - - - - - - - - - - -
ObSelect := NULL_OBJECT
endif

if LogicFunction == TRUE
obSql:Disconnect()
endif

obSql:=NULL_OBJECT
RETURN NIL