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
Give this a try.
cmd.CommandText = "Select CustCode 'Customer Code',CustName 'Customer Name',Caddress 'Address',Ccity 'City',cphone 'Phone' from Customer Order by CustCode"
Using this method you can change your header to any thing want.
How you make your select statement, I believe is how the data will appear in the data grid. As per your example, select item,date,street,name from table. The data should be displayed as follows: col0=item,col1=date,col2=street,col3=name
Correct me if I am wrong, the selection statement is how the grid will display the data.
Thanks for your support.
I forg0t to say one thing. My program support Multiple Language.
I keep a text_translation table where I can select languages for correspnding variable.
For eg: I keep two variable, 1. Customer 2. CustomerName
In Text Translation table, there will be corresponding text for each variable.
I need to bring the header in multilanguage support.
I don't think I can mix with a variable in SQL Query. If possible just help me.
Or do you know another way ?
Anyway with Table.AddCol() function ?
I used it but didn't get the value if I run an sql query. May be my coding mistake.
AddForm("CustView", "View Customer")
AddTable("CustView","CustGrid",30,50,200,150)
End Sub
HERE IF I comment the SQL Fetching Program, I get the header as per my requirement or as I defnined.
But If I call the SQL program I didnt get the header as per my requirement and instead I got the coloumn name of table definition.
I don't need the coloumn name, I need to define as I wish and it should be change along with How I select a language.
If I select Spanish as my default language It should be spanish text.
If I select English it will be in English