Sunday, March 20, 2011

Database manipulation is very simple with Semico Framework

Add a reference to the class that you created:

Imports SEMICO_Dialog.ClsQuickCode
Imports SEMICO_Dialog
Imports SEMICO_Dialog.ClsMessage

very simple to build connection string :

'untuk SQL server 
Dim connstrSQLserver = ProviderSQLserver("sa", "123456", "local", "luisdata")
'untuk Access 2003
Dim connstrAccess2003 = ProviderAccess(AppPath("tes.mdb"))
'untuk Access 2007
Dim connstrAccess2007 = ProviderAccess2007(AppPath("tes.accdb"))
'untuk mysql 
Dim connstrMySQL = ProviderMySQL_NET("sa", "", "localhost", "DB")

Set connection String to object :

Dim Conn As New ClsSQL(connstrSQLserver)

Simple Query Execution :

Conn.StringQuery = "Select * from kas"
Conn.Execute()
'or
Conn.Execute("select * from kas")


Simple Showing Data :

'using name Collumn
InfoMessage(Conn("keperluan"))
'Or using index 
InfoMessage(Conn(0))

Simple Navigation Rows Data :

If Conn.HasRows Then
  For i = 0 To Conn.RowCount - 1
    InfoMessage("keperluan")
    Conn.NextRow()
  Next
End If

Binding Data to Datagridview :

Conn.StringQuery = "Select * from kas"
DataGridView1.DataSource = Conn.Execute()
'or using datatable
DataGridView1.DataSource = Conn.Table
'Or using dataview
DataGridView1.DataSource = Conn.Dataview
SNAGHTML2dd308
 

Very simple Transaction :

'Transaction 
Conn.BeginsTrans()
Try
    Conn.Execute("delete from kas")
    Conn.Execute("delete from kas2")
    Conn.Execute("delete from kas3")
    Conn.CommitTrans()
Catch ex As Exception
    Conn.RollBackTrans()
End Try

simple Get Date Server :

Conn.GetDateServer()


Simple Set TimeOut Connection :

Conn.TimeOut = 9000

simple Get Next Number of AutoNumber Data :

Dim strnum = Conn.AutoNumber("id", "kas")
InfoMessage(strnum)

Simple Auto fill Data To Form :

Create Comtrol like below :
image

change the properties according to the data tag that will be included for each control

image

Dim Conn As New ClsSQL(connstrSQLserver)
Conn.StringQuery = "Select * from kas"
Conn.Execute()
Conn.BindingGroupControl(Me)

then the data will be automatically entered into every control that property already in the set of tags first:


SNAGHTML41be6f

No comments:

Post a Comment