From: tausarus on
METHOD PostInit(oWindow,iCtlID,oServer,uExtra) CLASS NewWindow1
LOCAL oSql AS SQLSelect

// oSql:= SQLSelect{ "SELECT * FROM Maas", oConn } -> Tüm
kayýtlarý listeler
// oSql:= SQLSelect{ "SELECT * FROM Maas WHERE (soyadi!='Çelik')",
oConn } -> Soyadý alanýnda soyadi=Çelik olanlarý listeler
// oSql:= SQLSelect{ "SELECT * FROM Maas WHERE (adi LIKE '%r%')",
oConn } -> Adi alanýnýn içerisinde r harfi geçenleri listeler
// oSql:= SQLSelect{ "SELECT * FROM Maas WHERE (adi LIKE 'n%')",
oConn } -> Adi alanýnýn BAÞINDA n harfi geçenleri listeler
// oSql:= SQLSelect{ "SELECT * FROM Maas WHERE (adi LIKE '%n')",
oConn } -> Adi alanýnýn SONUNDA n harfi geçenleri listeler


oConn := SqlConnection{"My_MYSQL","celik66","66celik"} // MySQL
*oConn := SqlConnection{"My_ORACLE","system","manager"} // Oracle
*oConn := SqlConnection{"My_MSSQL","sa",""} // MSSQL

IF oConn:Connected
oSql := SqlSelect{"Select x.perno,x.adi,x.soyadi, y.unvadi, x.adresi
from data11 x,data12 y where x.unvani=y.unvkod order by
x.perno",oConn}
*oSql := SqlSelect{"Select x.perno,x.adi,x.soyadi, y.unvadi from
data11 x,data12 y where x.unvani=y.unvkod order by x.perno",oConn}
oSql:Execute()
oDCDataListView1:Use(oSql)
* IF oSql:Used
* warningbox{SELF,"Uyarý","Dosya kullanýma açýldý"}:Show()
* ENDIF
ENDIF

RETURN NIL

/*
cSQL := "SELECT Count(*) AS Maas_Sayi FROM Maas WHERE (adi LIKE
'"+cQ+"')"
oData:=SQLSelect{ cSQL, oConn }
oData:Execute()

IF oData:FIELDGET(#Maas_Sayi)!=0
cSQL := "SELECT sum(maasi) AS Maas_Toplam FROM Maas WHERE (adi
LIKE '"+cQ+"')"
oData:=SQLSelect{ cSQL, oConn }
oData:Execute()

cSQL := "SELECT avg(maasi) AS Maas_Ortalama FROM Maas WHERE (adi
LIKE '"+cQ+"')"
oData:=SQLSelect{ cSQL, oConn }
oData:Execute()

cSQL := "SELECT Max(maasi) AS Maas_Max FROM Maas WHERE (adi LIKE
'"+cQ+"')"
oData:=SQLSelect{ cSQL, oConn }
oData:Execute()

cSQL := "SELECT Min(maasi) AS Maas_Min FROM Maas WHERE (adi LIKE
'"+cQ+"')"
oData:=SQLSelect{ cSQL, oConn }
oData:Execute()
ENDIF
oData:Close()

*/

METHOD mydeleterecord() CLASS NewWindow1
LOCAL oStat AS SqlStatement
LOCAL cStat AS STRING
LOCAL cP AS STRING

cP:=AllTrim(oDCSingleLineEdit1:TextValue)

cStat := "delete from data11 where perno='"+cP+"'"
oStat := Sqlstatement{cStat,oConn}
oStat:Execute()

SELF:yenile()


METHOD yenile() CLASS NewWindow1
LOCAL oSql AS SQLSelect

oSql := SqlSelect{"Select x.perno,x.adi,x.soyadi, y.unvadi, x.adresi
from data11 x,data12 y where x.unvani=y.unvkod order by
x.perno",oConn}
oSql:Execute()
oDCDataListView1:Use(oSql)

RETURN TRUE

METHOD myRecord() CLASS NewWindow1

LOCAL oStat AS SqlStatement
LOCAL cStat AS STRING
LOCAL cP,cA,cS,cU AS STRING

cP:=AllTrim(oDCSingleLineEdit1:TextValue)
cA:=AllTrim(oDCSingleLineEdit2:TextValue)
cS:=AllTrim(oDCSingleLineEdit3:TextValue)
cU:=AllTrim(oDCSingleLineEdit4:TextValue)

cStat := "insert into data11(perno,adi,soyadi,unvani) Values ('"+cP
+"','"+cA+"','"+cS+"','"+cU+"')"

oStat := Sqlstatement{cStat,oConn}
oStat:Execute()
IF oStat:ErrInfo:ErrorFlag
Warningbox{SELF,"Kayýt","Kayýt girilmiþ."}:Show()
oStat:ErrInfo:ShowErrorMsg()
ELSE
SELF:yenile()
ENDIF
oStat:FreeStmt()

METHOD myReplaceRecord() CLASS NewWindow1
LOCAL oStat AS SqlStatement
LOCAL cStat AS STRING
LOCAL cP,cA,cS,cU AS STRING

cP:=AllTrim(oDCSingleLineEdit1:TextValue)
cA:=AllTrim(oDCSingleLineEdit2:TextValue)
cS:=AllTrim(oDCSingleLineEdit3:TextValue)
cU:=AllTrim(oDCSingleLineEdit4:TextValue)

cStat := "update data11 set "+Symbol2String(#adi)+"='"+cA+"' where
perno='"+cP+"'"
oStat := Sqlstatement{cStat,oConn}
oStat:Execute()
SELF:Yenile()

RETURN TRUE
METHOD TableCreate() CLASS NewWindow1
LOCAL oStat AS SqlStatement
LOCAL cStat AS STRING
cStat := "CREATE TABLE Personel (sicil INT (12) NOT NULL
AUTO_INCREMENT,PRIMARY KEY (sicil),adi VARCHAR (30) NOT NULL )
TYPE=MyISAM"

oStat := Sqlstatement{cStat,oConn}
oStat:Execute()

METHOD fieldappend() CLASS NewWindow1
LOCAL oStat AS SqlStatement
LOCAL cStat AS STRING

cStat := "ALTER TABLE data11 ADD adresi VARCHAR(20)"
oStat := Sqlstatement{cStat,oConn}
oStat:Execute()

METHOD fieldrep() CLASS NewWindow1
LOCAL oStat AS SqlStatement
LOCAL cStat AS STRING

cStat := "ALTER TABLE data11 MODIFY adresi VARCHAR(25)"
oStat := Sqlstatement{cStat,oConn}
oStat:Execute()

 | 
Pages: 1
Prev: Performance over network
Next: vo2ado