Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help connecting to SQL database & creating dynamic toolbar
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:


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

Macro Macro2833
Select All      Help

;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"

Forum Jump:

Users browsing this thread: 1 Guest(s)