Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help connecting to SQL database & creating dynamic toolbar
#1
I am trying to create a dynamic toolbar that gets defined by data stored in a SQL Server database table, this toolbar would be used by dozens of users, but each users specific toolbar settings would be stored in the database. This would allow one set of QM code to be installed on each workstation, then each users specific settings would be stored in the database.

Upon logging into a SQL Server database and reading the data stored for the specific user, the QM code would then build the toolbar based on values stored in that database.

Does anyone have any sample code that would allow me to connect to the database by logging in with sqlserver authentication, then reading data from specific database tables (I guess we could use windows authentication on SQLServer if needed)

I am trying to prove a concept works, then if I can actually accomplish what I am trying to achieve I will wind up hiring someone who can write part of this program for me. If anyone on the forum is interested in assisting with my project, please let me know, you can send me a private message.


Gintaras said I should try using the following classes and functions:

Database
Sqlite
ICsv
DynamicToolbar
DynamicMenu
newitem

If anyone has any sample code using any of the above and you would be willing to share it with me, please let me know. Any assistance would be appreciated

Thanks
#2
Macro Macro2833
Code:
Copy      Help
out

;Here I use an Excel file as a database.
;File: $documents$\toolbars.xls
;Sheet: Sheet1
;Data (3 columns):
;Label    Code    Icon
;One    out 1    $qm$\paste.ico
;Two    out 2    

Database db.Open(db.CsExcel("$documents$\toolbars.xls")) ;;if error, close Excel. To see more examples, click word Database and press F1.
ARRAY(str) a; int c
db.QueryArr("SELECT * FROM [Sheet1$]" a) ;;first row is used for headers
str s
for c 0 a.len
,if(a[2 c].len) s+F"{a[0 c]} :{a[1 c]} * {a[2 c]}[]"
,else s+F"{a[0 c]} :{a[1 c]}[]"
;out s
DynamicToolbar s "test34598"
#3
@Gintaras 
Thanks for sharing, it's a nice feature

the code for Label Two, which is multi-line, how to automatically create subfunctions ?
When there are spaces in the label, the automatic naming of the subfunction is also handled

e.g:


Toolbar test34598
Code:
Copy      Help
one :out 1 * $qm$\paste.ico
two :sub.two * $qm$\copy.ico
three obj :sub.three * $qm$\cut.ico

#sub two
str s="hello world two"
mes s

#sub three
str s="hello world three"
mes s


​​​​​​​I want to add options and a close button to the toolbar, and when there are subfunctions, It will also have no effect
​​​​​​​
s-" /siz 210[]"
s+"[]-[]Close :clo val(_command) * close.ico"


Forum Jump:


Users browsing this thread: 2 Guest(s)