I just tried again, and I have problems to connect to the server, error message "no connection to server",
I've tried to change the file " httpd-xampp.conf" and "my.ini".
sorry my posting to the forum because I already clogged
terimakasih,
beni
the example program
#include "hmg.ch"
Function lap99
Local mdrv
Private oServer := Nil
DEFINE WINDOW Win_1 ;
AT 100,200 ;
WIDTH 640 ;
HEIGHT 480 ;
TITLE 'Tanda Terima BPKB' ;
MODAL ;
ON INIT Connect() ;
ON RELEASE Disconnect()
flg:='1'
@ 50,50 LABEL LABEL_1 VALUE 'Nopsb'
@ 80,50 LABEL LABEL_2 VALUE 'Nama'
@ 110,50 LABEL LABEL_3 VALUE 'Tgl Cair'
@ 140,50 LABEL LABEL_4 VALUE 'Nomor BPKB'
@ 50,170 TEXTBOX TEXT_1;
TOOLTIP 'NoPsb 7 digit' ;
MAXLENGTH 7 ;
ON ENTER cekid99()
ON GOTFOCUS cekid99()
@ 80,170 TEXTBOX TEXT_2 WIDTH 250
@110,170 DATEPICKER TEXT_3 ;
VALUE date()
@140,170 TEXTBOX TEXT_4 ;
VALUE 0 ;
TOOLTIP 'Numeric TextBox' ;
NUMERIC INPUTMASK "99,999,999"
@380,170 BUTTON Button_1 ;
CAPTION " Simpan" ;
WIDTH 120 HEIGHT 26 ;
ACTION Save99()
END WINDOW
Win_1.Text_1.SetFocus
CENTER WINDOW Win_1
ACTIVATE WINDOW Win_1
Return Nil
Procedure Save99
* msgbox(flg)
if flg='1'
cQuery := "insert into NASABAH (nopsb, nama, tglcair, bpkb) values ("+c2sql(Win_1.Text_1.value)+", "+c2sql(Win_1.Text_2.value)+", "+;
c2sql(Win_1.Text_3.value)+", "+c2sql(Win_1.Text_4.value)+")"
else
cQuery := "update NASABAH set "
cQuery += "NAMA = "+c2sql(Win_1.Text_2.value)
cQuery += ", TGLCAIR = "+c2sql(Win_1.Text_3.value)
cQuery += ", BPKB = "+c2sql(Win_1.Text_4.value)
cQuery += " where NOPSB = "+c2sql(Win_1.Text_1.value)
endi
oQuery := oServer:Query( cQuery )
if oQuery:NetErr()
msginfo("Record not saved")
else
msginfo("Record saved")
endi
Win_1.Text_1.value:=space(10)
Win_1.Text_2.value:=space(10)
Win_1.Text_3.value:=space(10)
Win_1.Text_4.value:=space(10)
Win_1.Text_1.SetFocus
Return
Procedure cekid99
mnopsb:=Win_1.Text_1.value
oQuery := SQL(oServer, "Select * From NASABAH WHERE NOPSB =" + C2SQL(Win_1.Text_1.value ) )
if len(oQuery) > 0
TEXT_2:=oQuery[1,2]
msgbox(oQuery[1,1])
msgbox(oQuery[1,2])
Win_1.Text_2.value:=oQuery[1,2]
Win_1.Text_3.value:=oQuery[1,3]
Win_1.Text_4.value:=oQuery[1,4]
flg:='0'
else
flg:='1'
endif
Return flg
*------------------------------------------------------------------------------*
Procedure Connect
*------------------------------------------------------------------------------*
/*
Class TMySQLServer:
- Manages access to a MySQL server and returns an oServer object
to which you'll send all your queries.
- Administra el acceso a un servidor MySql y retorna un objeto
oServer al cual se le enviaran los comandos SQL.
Method New(cServer, cUser, cPassword):
- Opens connection to a server, returns a server object.
- Abre una conexion a un servidor, retorna un objeto servidor.
Method NetErr():
- Returns .T. if something went wrong
- Retorna .T. en caso de error.
Method Error():
- Returns textual description of last error.
- Retorna la descripcion del ultimo error.
Method SelectDB(cDBName):
- Which data base I will use for subsequent queries.
- Selecciona la base de datos que se usara en los siguientes
consultas.
*/
// Connect
oServer := TMySQLServer():New("192.168.2.3", "root", "1122")
// Check For Error
If oServer:NetErr()
MsgStop(oServer:Error())
Win_1.Title := 'MySql Basic Sample - Not Connected'
Else
MsgInfo("Connected")
Win_1.Title := 'MySql Basic Sample - Connected'
// Select DataBase - Seleccionar Base de Datos
oServer:SelectDB( "BPKB" )
// Check For Error - Verificar Errores
If oServer:NetErr()
MsgStop( oServer:Error() )
Endif
EndIf
Return
*------------------------------------------------------------------------------*
Procedure Disconnect()
*------------------------------------------------------------------------------*
/*..............................................................................
Class TMySQLServer - Method Destroy():
- Closes connection to server.
- Cierra la conexion con un servidor.
..............................................................................*/
oServer:Destroy()
Win_1.Title := 'MySql Basic Sample - Not Connected'
Return
function sql(dbo1,qstr)
local table := nil
local currow := nil
local tablearr := {}
local rowarr := {}
local curdateformat := set(_SET_DATEFORMAT)
local i := 0
local j := 0
if dbo1 == nil
return nil
endif
set date ansi
table := dbo1:query(qstr)
set(_SET_DATEFORMAT,curdateformat)
if table:neterr()
msgstop(table:error())
table:destroy()
return tablearr
else
if table:lastrec() > 0
asize(tablearr,0)
for i := 1 to table:lastrec()
asize(rowarr,0)
currow := table:getrow(i)
for j := 1 to table:fcount()
aadd(rowarr,currow:fieldget(j))
next j
aadd(tablearr,aclone(rowarr))
next i
endif
table:destroy()
return tablearr
endif
return tablearr
function miscsql(dbo,qstr)
local curdateformat := set( _SET_DATEFORMAT)
if dbo == nil
return nil
endif
set date ansi
table := dbo:query(qstr)
set( _SET_DATEFORMAT,curdateformat)
if table:NetErr()
msgstop(table:ERROR())
table:destroy()
return .f.
endif
table:destroy()
return .t.
function C2SQL(Value)
local cValue := ""
do case
case Valtype(Value) == "N"
cValue := AllTrim(Str(Value))
case Valtype(Value) == "D"
if !empty(Value)
cValue := "'"+DTOS(value)+"'"
else
cValue := "'00000000'"
endif
case Valtype(Value) $ "CM"
IF Empty( Value)
cValue="''"
ELSE
cValue := "'" + value + "'"
ENDIF
case Valtype(Value) == "L"
cValue := AllTrim(Str(iif(Value == .F., 0, 1)))
otherwise
cValue := "''" // NOTE: Here we lose values we cannot convert
endcase
return cValue
connect to the server with the IP
Moderator: Rathinagiri
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: connect to the server with the IP
Had you given exception to the Firewall settings in both Server and client machines?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: connect to the server with the IP
do not use a firewall, I test on one computer only ( xampp versi 1.8)
rathinagiri wrote:Had you given exception to the Firewall settings in both Server and client machines?
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: connect to the server with the IP
In that case, please use 'localhost' instead of IP number and try.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: connect to the server with the IP
thanks ratih finished.