Dear Friend,
I have a customer table in SQLite DB. I need to show data from the table in my application.
Table definition is like
Table Name: Customer
Field Name1 : CustomerCode
Field Name2 : CustomerName
In my application the header of the data grid should be like
CUSTOMER CODE and CUSTOMER NAME instead of CustomerCode and CustomerName respectively.
that means I can define the header as I wish.
Here I used a form called CustView. and I used a controller Table called CustGrid
I used below code for this
CustGrid.AddCol(cString, "CUSTOMER CODE", 50)
CustGrid.AddCol(cString, "CUSTOMER NAME", 150)
But When I retrieve the data from the database table I got the header as in the table definition ie CustomerCode and CustomerName .
My Question is How I can define the header as I wish ?
My program is attached herewith as well as I am copying my code here.
Sub Globals
'Declare the global variables here.
End Sub
Sub App_Start
CreateConnection
CreateTableIfNotExists
Designer
CustView.Show
Connection.BeginTransaction
Command.CommandText = "SELECT * FROM customer"
Command.ExecuteTable("CustGrid", 1000)
Connection.EndTransaction
End Sub
Sub CreateConnection
Connection.New1
Command.New1("", Connection.Value)
Connection.Open("Data Source = " & AppPath & "\customer.sl3")
End Sub
Sub CreateTableIfNotExists
Command.CommandText = "SELECT name FROM sqlite_master WHERE type = 'table' AND name='customer'"
'instantiate reader
Reader.New1
'Fill reader
Reader.Value = Command.ExecuteReader
If Reader.ReadNextRow = False Then
' No table with this name in the database.
' Create one.
Reader.Close
Command.CommandText = "CREATE TABLE customer (CustomerCode TEXT PRIMARY KEY, CustomerName TEXT)"
Command.ExecuteNonQuery
Else
'Close reader anyhow
Reader.Close
End If
End Sub
Sub Designer
AddForm("CustView", "View Customer")
AddTable("CustView","CustGrid",30,50,200,150)
CustGrid.AddCol(cString, "CUSTOMER CODE", 50)
CustGrid.AddCol(cString, "CUSTOMER NAME", 150)
End Sub
Please see the attachment and run it
Expecting your help.
Thanking you
Jotis
I have a customer table in SQLite DB. I need to show data from the table in my application.
Table definition is like
Table Name: Customer
Field Name1 : CustomerCode
Field Name2 : CustomerName
In my application the header of the data grid should be like
CUSTOMER CODE and CUSTOMER NAME instead of CustomerCode and CustomerName respectively.
that means I can define the header as I wish.
Here I used a form called CustView. and I used a controller Table called CustGrid
I used below code for this
CustGrid.AddCol(cString, "CUSTOMER CODE", 50)
CustGrid.AddCol(cString, "CUSTOMER NAME", 150)
But When I retrieve the data from the database table I got the header as in the table definition ie CustomerCode and CustomerName .
My Question is How I can define the header as I wish ?
My program is attached herewith as well as I am copying my code here.
Sub Globals
'Declare the global variables here.
End Sub
Sub App_Start
CreateConnection
CreateTableIfNotExists
Designer
CustView.Show
Connection.BeginTransaction
Command.CommandText = "SELECT * FROM customer"
Command.ExecuteTable("CustGrid", 1000)
Connection.EndTransaction
End Sub
Sub CreateConnection
Connection.New1
Command.New1("", Connection.Value)
Connection.Open("Data Source = " & AppPath & "\customer.sl3")
End Sub
Sub CreateTableIfNotExists
Command.CommandText = "SELECT name FROM sqlite_master WHERE type = 'table' AND name='customer'"
'instantiate reader
Reader.New1
'Fill reader
Reader.Value = Command.ExecuteReader
If Reader.ReadNextRow = False Then
' No table with this name in the database.
' Create one.
Reader.Close
Command.CommandText = "CREATE TABLE customer (CustomerCode TEXT PRIMARY KEY, CustomerName TEXT)"
Command.ExecuteNonQuery
Else
'Close reader anyhow
Reader.Close
End If
End Sub
Sub Designer
AddForm("CustView", "View Customer")
AddTable("CustView","CustGrid",30,50,200,150)
CustGrid.AddCol(cString, "CUSTOMER CODE", 50)
CustGrid.AddCol(cString, "CUSTOMER NAME", 150)
End Sub
Please see the attachment and run it
Expecting your help.
Thanking you
Jotis
Attachments
Last edited: