Logo aziendale


Cell. +39 335 70 310 78

mail gianluca.pezzoli@gianlucapezzoli.eu

English version Versione italiana del sito

Products \ Miranda

How to use Miranda inside the code?

Firstly you must create a DataLink (the connection to the DBMS) specifying the connection string.

Dim SqlServer As New Pezzoli.Data.Miranda.SqlServerClient.SqlServerDataLink(ConnectionString)

Then instantiate the class (entity) that is the single record of the table.

Dim Val As New RigaOrdine

The code that defines this class / entity (RigaOrdine) is obtained from MyGeneration (see below).

Now we have to instantiate the class manager Val (Proxy). The line below is used to tell the Proxy that will send commands to the SQL server with the name defined over SqlServer.

Dim Proxy As New Pezzoli.Data.Miranda.Proxy()
Proxy.DataLink = SqlServer

Finally we have to tell the Proxy who are required to manage (load, track and changes and save, delete) data in Val, the instance of the RigaOrdine type defined above

Proxy.Entity = Val

Now we are ready to make ...

Select
Proxy.Load("IDOrdine = 99 And Descrizione='X""X'X'")

oppure

Dim Key As New Pezzoli.Data.Miranda.EntityKey()
Key.Add(New Pezzoli.Data.Miranda.EntityKeyItem("IDOrdine", 99))
Key.Add(New Pezzoli.Data.Miranda.EntityKeyItem("Descrizione", "'X""X'X'"))
Proxy.Load(Key)

Insert
Val.IDOrdine = 44
Val.Descrizione = "Pippo"
Proxy.Insert()

Update
First I do a Load. Then

Val.Descrizione = "Pippo"
Proxy.Update()

Delete
First I do a Load.Then

Proxy.Delete()

<< Back Forward >>

Related resources