04-17-2023 06:45 AM
I downloaded DB Browser for SQLite to convert .csv in .db file. So i want to call the Database with Diadem. but i don't know how to connect ADO to read this .db file. PLZ Help 🙂
Option Explicit 'Forces the explicit declaration of all the variables in a script.
Dim ADO, RecordSet, Table, ColStr, CondStr, SortStr, ConnectionStr, QueryStr, RowVals
ConnectionStr = "Treiber ?????" & CurrentScriptPath
ConnectionStr = ConnectionStr & "Test.db"
'############################################# to fill in SQL
Table = ""
ColStr = ""
CondStr = ""
SortStr = ""
QueryStr = "SELECT" & ColStr & "From" & Table & CondStr & SortStr
MsgBox QueryStr
'#############################################
Set ADO = CreateObject ("ADODB.Connection")
ADO.Open ConnectionStr
'#############################################
Set RecordSet = ADO.Execute(QueryStr)
RowVals = RecordSet.GetRows()
'#############################################
Call Data.Root.Clear
Call Data.Root.ChannelGroups.Add(Table)
Channels = GetChanNames(ColStr)
call ArrayToChannels(RowVals, Channels, 1)
'#############################################
ADO.Close
04-18-2023 02:55 AM
Hi,
I understand that you have now a SQLite database to which you want to connect via DIAdem.
You can use the commands SQLiteOpen, SQLiteClose and SQLiteQuery to connect to it.
The commands are available starting with DIAdem version 2020. https://www.ni.com/pdf/manuals/375399h.html
I think this will be the easiest option, but I do not know your DIAdem version.
Otherwise DIAdem includes are very good example for the use of ADO elements:
https://www.ni.com/docs/en-US/bundle/diadem/page/ado/ado/ado_example.htm
04-25-2023 02:26 AM
thank you very much 😍