03-08-2010 09:27 AM
Hi Michela,
Would you please post the SQL query you copied and pasted from the Wizard to your own data base query tool that didn't run successfully-- the one that had "too many spaces"? That should give me a clue as to what needs to change in the Wizard code. I did recently get the SQL Wizard working for a customer with a SQL Server data base, so I'm cautiously optimistic that we can get this to work. In the mean time I also have a 10.2 version. What version of DIAdem do you have?
Brad Turpin
DIAdem Product Support Engineer
National Instruments
03-09-2010 03:33 AM
Hi Brad,
I am able to load my DB in the Internal database window, I can see all the tables, each of them with their columns. If I check the table box, the data goes into the Attribute tab of the DataNavCtrl object. But when I try to load the tables into the dataportal (using data operation button - LoadSelectedData) the all tables are empty (just the name and the properties, no colums). See dataportal attached
If anyway I try to launch a query, It doesn't work, I receive a sql message like:
"SELECT COUNT( engID ) FROM ProjectInfo WHERE ( engID =5) " I should return 1 row, but I get an error message instead...
If I paste it into SQL I get an error either. I had to modify the query cleaning it up to the white spaces and after that it works...
The new query text is:"SELECT COUNT(engID)FROM ProjectInfo WHERE(engID=5)"
What do you think?
Thanks,
Michela
03-09-2010 02:06 PM
Hi Michela,
It looks from the query you posted that there is an incorrect QuoteStr or DateStr set up parameter assigned to wizard in line 11, which should look like this:
DBs = AddDB(DBs, " MyDataBase | | | | ' | DATABASE=...;DRIVER={MySQL ODBC 3.51 Driver};OPTION=0;PWD=...;PORT=0;SERVER=...;UID=...;")
I think somehow you put a TAB character between some of those pipe "|" characters...
Brad Turpin
DIAdem Product Support Engineer
National Instruments
03-10-2010 09:35 AM
It doesn't work either... I pasted the adapted string you sent me but probably there is something wrong... when I launch the script I et the following error message (attached)
03-11-2010 05:02 AM
Hi Brad,
can you suggest me an easy way to import sql table (maybe temporary tables resuted from sql queries) into diadem dataportal? The wizard doesn't work and I am not an VBS expert to fix the problems in a quick and easy way...
I saw some exemples in the help guide where they use the SQL_BindChannel instruction, such as:
....
If (SQL_ConnectStat = true) Then
Call SQL_ExecDirect("Select * From ProjectInfo")
If (SQL_Stat > 0) Then
Call SQL_BindChannel("engID","engID","n")
Call SQL_BindTextChn("Matricola","Matricola","n")
Call SQL_BindTextChn("Distinta","Distinta","n")
Call SQL_BindChannel("Revisione","Revisione","n")
Call SQL_BindChannel("DVPandR","DVPandR","n")
Do While SQL_Next
Call SQL_FetchNext()
Loop
End If
Using SQL_BindChannel or SQL_BindTextChn instructions I have to know in advance names of the colums and types of data... Do you know how to import the data (all the colums of a tables) automatically letting Diadem discriminate among the different types of data?
Thanks,
Michela
03-11-2010 03:20 PM
Hi Michela,
The error message you posted indicates that you were unable to connect to your data base with the new parameter string I sent you. But were able to connect before, right? That means we just didn't get the new parameter string right, which means we haven't yet successfully tested the new parameters. Would you post the exact corresponding parameter string line that you used to have? Please also repost the exact corresponding string line from your current code, so I can see if I can find the error.
The answer to your newest question depends on your DIAdem version. Assuming your DIAdem version is new enough, I would not recommend the SQL_ commands but rather the ADO object approach. I would be happy to send you a small VBScript that shows how to configure and run an SQL query without the SQL Wizard, but first I need to know what DIAdem version you have.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
03-11-2010 03:25 PM
Hi Michela,
I took a closer look at your error message screen shot and realized the answer to my question was staring me in the face. I was not suggesting that you change the ADO connection string part of that string line. Please revert back to your DSN approach in the last parameter, but use all the other parameters from the new string line.
I can't tell from the screenshot what your exact DIAdem version is,
Brad Turpin
DIAdem Product Support Engineer
National Instruments
03-12-2010 03:30 AM
Great!!
Thanks you very much!!!
I used the DSN approach with all the other parameters from the new string line you sent me and: 1) I get the connection to the DB; 2) I am able to load the data tables in the data portal(!!); and 3) I launch some queries and I get the correct results in the Query Database Records Table!!
I have 10.2 Diadem Version and my DB created by Microsoft SQL Server 2005.
Could you give me some suggestions on how to import sql tables and query results in the Diadem dataportal... Honestly it's pretty difficult for me to understand the wizard script... although it's really really useful I need to create a kind of simplest application similar to your wizard... By the way, can you suggest me some useful documents which could help me?
03-12-2010 06:03 AM
Hi Brad,
Looking around I found the "MyADO_Example" you sent at the discussion: http://forums.ni.com/ni/board/message?board.id=60&message.id=7619&query.id=1920348#M7619.
I adapted the script to my DB and now I am able to load easly my tables in the Diadem dataportal. This is the first step of my goal, my second step would be learn how to launch query and loading the results for Diadem Reports...
Anyway, now I adapted a "someone-else" script to my case... next i have to learn how to create it by myself...
I will be glad to follow all your suggestion!!
Thanks again,
Michela
03-12-2010 11:33 AM
Hi Michela,
With DIAdem 10.2 I would definitely recommend the ADO approach you already found an example of, and I would recommend that you forget all about the SQL_ functions. Please let me know if I can help you further with ADO or VBScript questions in DIAdem.
Brad Turpin
DIAdem Product Support Engineer
National Instruments