Sql til opretelse i træ kontrol

Brugerhjælp og support til makroer i LibreOffice Basic

Moderators: Lodahl, LarsBrandi

Post Reply
Leif Laursen
Posts: 7
Joined: Sun Nov 06, 2011 13:54
Location: Midt jylland
Contact:

Sql til opretelse i træ kontrol

Post by Leif Laursen » Fri Jul 27, 2012 12:02

Hej der ude er der ikke nogen der lige kun tage et blik på min kode.
:roll: et år gammel ny begynder
Det er memlig sådan at jeg forsøger at bruge en Sql gennem en createUnoService("com.sun.star.sdb.RowSet")
Problemet se ud til at være at få den implementer riktigt
Er der nogen der Ved noget.
:cry: på forhånd tak.

Code: Select all

private oTreeControlDialog as object
public oTreeControl as object
private oMutableTreeDataModel as object
private oTreeModel as object
Dim DatabaseContext As Object
Dim DataSource As Object
Dim Connection As Object
 
Sub TreeControl
	dim oRoot as object
	dim oParent as object
	dim oChild as object
	dim resultset as integer
	  
	Dim stk as integer
	DialogLibraries.loadLibrary("Standard")

	oTreeControlDialog = CreateUnoDialog(DialogLibraries.Standard.Dialog1)
	

	oMutableTreeDataModel = createUnoService("com.sun.star.awt.tree.MutableTreeDataModel")

	oRoot = oMutableTreeDataModel.createNode("Root", true)

	oMutableTreeDataModel.setRoot(oRoot)

	oParent = oMutableTreeDataModel.createNode("Object", true)

DBContext=createUnoService("com.sun.star.sdb.DatabaseContext")


DataSource=DBContext.getByName("Leif")
ConnectToDB=DataSource.GetConnection ("","")
SQLResult=createUnoService("com.sun.star.sdb.RowSet")

SQLQuery= "SELECT  ""STK""FROM ""STK"""
SQLResult.activeConnection = ConnectToDB
SQLResult.Command = SQLQuery
SQLResult.execute

SQLResult.next
skt = SQLResult.getint(1)
 

 
	oParent.appendChild(oMutableTreeDataModel.createNode("stk" & str(stk)  ,falsk))

	oRoot.appendChild(oParent)
	
	oTreeControl = oTreeControlDialog.getControl("TreeControl1")
	
	oTreeModel = oTreeControl.Model

	oTreeModel.DataModel = oMutableTreeDataModel
	'Start the dialog
	oTreeControlDialog.execute()
End Sub
Styresystem vin 7 LibreOffice 3.5.5.3

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest