LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parameterized query format for select statement


@HowardB wrote:

So for the select statement, the Labview vi does not use named parameters?  So then I must set the parameters in the same order as the ?'s appear?


You may be able to use names of a certain format, like "@abc" in place of "?".  It may depend on what SQL database you are connecting to.   

0 Kudos
Message 11 of 27
(2,278 Views)

I was able to use named parameters with an SQL string as follows:

 

SELECT * FROM TEST_SETUP WHERE OPERATOR LIKE (@operator) AND LOT LIKE (@lot) ;

 

Then I used the Set parameter vi to set each parameter.

 

Thanks for the help!

0 Kudos
Message 12 of 27
(2,265 Views)

Hiii HowardB
I am facing the sme problem.
Can You pls share your vi file??
Thank You

0 Kudos
Message 13 of 27
(2,171 Views)
Rather than just saying "me too", how about explaining the issue you are having -- including what kind of DB you are talking to. The previous solution might not work for you.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 14 of 27
(2,164 Views)

Hii Mike
Thank you for reply
I am using acess 2007 database
I want to select the the data in database using string control like "Select Product,Dimension,Weight From ProductInfo where Barcode(string control)=?"  and also display the same in front panel table

I am using Database connecting toolkit.
I saw the example of parameterized insert but it didn't help to use parameterized select query and also not to diplay data of parameterized select query

I looked for example on parameterized select query but i didn't get any example.
So pls guide me how to do this. I would like to know other method(if any) to perform same.
If possble pls share a reference vi.
Thank you!!!

 

0 Kudos
Message 15 of 27
(2,157 Views)

Parameterized Query.png

Message 16 of 27
(2,138 Views)

Hii Howard
Thank You So Much!!!!!!!!!!!

0 Kudos
Message 17 of 27
(2,131 Views)

Does this work if you don't have a parameterized query in Access.  I'm using Access 2016 and I can't get this to work.

 

 

0 Kudos
Message 18 of 27
(1,788 Views)

Did you try putting parenthesis around @analysis and @Component?

0 Kudos
Message 19 of 27
(1,769 Views)

ParamQuery001a.JPGYes, just did try that.  I get the following error.

 

Error -2147217900 occurred at NI_Database_API.lvlib:Cmd Execute.vi->GetSampleID_FromAccessDB.vi

Possible reason(s):
ADO Error: 0x80040E14
Exception occured in Microsoft Access Database Engine: Syntax error (missing operator) in query expression '1stSampleID = (@1stSampleID) and Analysis =(@Analysis) and Component = (@Component)'. in NI_Database_API.lvlib:Rec Create - Command.vi->NI_Database_API.lvlib:Cmd Execute.vi->GetSampleID_FromAccessDB.vi

0 Kudos
Message 20 of 27
(1,765 Views)