H.Brill | Hello Roland, If one with SQLEXEC as last Parameter one lever a GridBOX angibt, so go Yes The Results with SELECT there into written.
what now unschön is : The Spaltenbreiten with numerischen Feldern go heavy minimizes. in the momentum behelfe I me with
LVM_SetColumnWidth
and vergrößere The Split on the origin again. can you the so take on, that too with whom numerischen Feldern The Ursprungsgröße the boxes from the GridBOX übernommen go ?
enclosed time one small Testcode (here with Firebird), the the exemplifies : CompileMarkSeparation $H commctrl.ph
Declare Handle fbdll, db1, stw, Gridbox1, Gridbox2, btn1, btn2, btn3, edit1
Declare Int ende
Declare SQL$
Declare Memory L
Dim L, 8
Long L, 0 = 440, -1
Declare String dbPfad
dbPfad = $ProgDir + "Daten\Test.fdb"
Window 650, 600
Gridbox1 = @Create("Gridbox", %HWnd, "Nummer;0;80;Name;0;240;Menge;1;120;Preis;2;100", 0, 10, 80, 510, 200)
Gridbox2 = @Create("Gridbox", %HWnd, "Nummer;0;80;Name;0;240;Menge;1;120;Preis;2;100", 0, 10, 300,510, 200)
btn1 = @Create("Button", %HWnd, "Suche", 10, 10, 60, 25)
edit1 = @Create("Edit", %HWnd, "Select * From Artikel Where ", 80, 10, 500,25)
btn2 = @Create("Button", %HWnd, "Lesen", 10,40, 60, 25)
btn3 = @Create("Button", %HWnd, "Ende", 110,40,60, 25)
stw = @Create("StatusWindow", %HWnd, "", 2, L)
fbdll = db("fbUseDll", "fbembed.dll")
IfNot FileExists(dbPfad)
db1 = db("fbCreate", "SYSDBA", "masterkey", dbPfad)
db("fbSQLExec", db1, "CREATE TABLE ARTIKEL (Nummer NUMERIC(5,0), Name CHAR(30), Menge NUMERIC(4,0), Preis NUMERIC(4,2))", 1)
SetText stw, 0, "Datenbank : " + dbPfad + " wurde angelegt !"
FuelleDB()
Else
db1 = db("fbInit", "SYSDBA", "masterkey", dbPfad)
SetText stw, 0, "Datenbank : " + dbPfad + " ist geöffnet !"
EndIf
ende = 0
WhileNot ende
WaitInput
If @Clicked(btn3)
ende = 1
ElseIf @Clicked(btn2)
LeseDatei()
ElseIf @Clicked(btn1)
' SQL Statement
SQL$ = GetText$(edit1)
@db("fbSQLExec", db1, SQL$, Gridbox2)
SendMessage(Gridbox2, ~LVM_SETCOLUMNWIDTH, 2, 120)' Breite 3 + 4 Spalte wieder herstellen
SendMessage(Gridbox2, ~LVM_SETCOLUMNWIDTH, 3, 100)
EndIf
Case %Key = 2 : ende = 1
EndWhile
db("fbDone", db1)
FreeDll fbdll
Dispose L
Proc FuelleDB
Declare String SQLS[]
SQLS[0] = "INSERT INTO Artikel (Nummer,Name,Menge,Preis) VALUES (100,'Tafel-Bananen',100,1.50)"
SQLS[1] = "INSERT INTO Artikel (Nummer,Name,Menge,Preis) VALUES (200,'Tafel-Birnen',1000,0.50)"
SQLS[2] = "INSERT INTO Artikel (Nummer,Name,Menge,Preis) VALUES (300,'Tafel-Äpfel',1500,0.30)"
SQLS[3] = "INSERT INTO Artikel (Nummer,Name,Menge,Preis) VALUES (400,'Tafel-Kirschen',10000,1.75)"
SQLS[4] = "INSERT INTO Artikel (Nummer,Name,Menge,Preis) VALUES (500,'Johannisbeeren',80,3.50)"
SQLS[5] = "INSERT INTO Artikel (Nummer,Name,Menge,Preis) VALUES (600,'Erdbeeren',200,0.65)"
SQLS[6] = "INSERT INTO Artikel (Nummer,Name,Menge,Preis) VALUES (700,'Brombeeren',140,1.10)"
SQLS[7] = "INSERT INTO Artikel (Nummer,Name,Menge,Preis) VALUES (800,'Most-Äpfel',100,0.80)"
SQLS[8] = "INSERT INTO Artikel (Nummer,Name,Menge,Preis) VALUES (900,'Most-Birnen',70,0.45)"
SQLS[9] = "INSERT INTO Artikel (Nummer,Name,Menge,Preis) VALUES (1000,'Most-Kirschen',500,0.50)"
SQLS[10] = "INSERT INTO Artikel (Nummer,Name,Menge,Preis) VALUES (1100,'Ess-Bananen',100,1.50)"
WhileLoop 0, 10
db("fbSQLExec", db1, SQLS[&LOOP], 1)
EndWhile
SetText stw, 0, "11 Datensätze geschrieben !"
EndProc
Proc LeseDatei
ClearList Gridbox1
@db("fbSQLExec", db1, "SELECT * FROM Artikel", Gridbox1)
SendMessage(Gridbox1, ~LVM_SETCOLUMNWIDTH, 2, 120)' Breite 3 + 4 Spalte wieder herstellen
SendMessage(Gridbox1, ~LVM_SETCOLUMNWIDTH, 3, 100)
ENDPROC
End
let in Proc LeseDatei The 2 SendMessage-command time lane. then you see, I my. |
|