Get value result of the query to the database

I have a table:

Id|num1|num2|num3
1|30|31|32|
2|33|34|35|
3|36|37|38|
4|39|40|41|
5|42|43|44|

Assign>>pp=“38”

I make the following query to the database:
“SELECT num1 FROM datos.libros where num3=‘+pp.ToString+’”

I need to get the num1 converted to string but I don’t know how to get it

The expression
**Select num1 From datos.libros where num3 = @pp **
So this will give us a datatable with a single column
And to change the datatype of that column
datatable.Columns(“yourcolumnname”).Datatype = GetType(system.String)

Cheers @Sebasthian_Arias

thanks bro,

I did not understand well it would look like this?

** " SELECT num1 FROM datos.libros where num3= '@pp ’ " **

I need to print the result of the query in a comment box

Yah that cor
Please go ahead
Cheers @Sebasthian_Arias

I don’t know how to do it, it’s not clear.

You were almost done

Same as in the above image

Were you facing any issue in that buddy
Cheers @Sebasthian_Arias

well, 1. I generated the query like this:

" SELECT num1 FROM data.books where num3 = ‘@ pp’ "

  1. I defined a TRANS variable to perform the transformation of this data table called Result and it was defined as follows:

TRANS = Result.Columns (“num1”). Datatype = GetType (system.String)

  1. When I give a message box I define it as TRANS.ToString

But the result is TRUE and not the value found in the database.

Help me please

image

when defining a variable along thee query we dont need single quote buddy
the expression be like this
" SELECT num1 FROM data.books where num3 = @ pp "
and may i know would you like to see any specific value from that datatable
as a value to TRANS
then
the expression be like this
Result.Rows(rowindex)(“yourcolumnname”).ToString
where row index starts from 0 for first row

or if you want to see the whole datatable as a string, then use OUTPUT DATATABLE activity next to this execute queryy and pass the input as Result and get the output with a varaible of type string named str_output

Cheers @Sebasthian_Arias

1 Like

“SELECT num1 FROM datos.libros where num3=@pp”
I did what you told me to remove the single quotes, declare it as output data table and the following error appears

image

RemoteException wrapping System.Data.Odbc.OdbcException: ERROR [HY000] [Oracle][ODBC][Ora]ORA-00936: missing an expression

I left the single quotes and made the query but it brought me the name of the table num1 and not the value

"SELECT num1 FROM datos.libros where num3=’ @pp’ "

Fine
may i know what value you need from that output datatable from this execute query activity
Cheers @Sebasthian_Arias

i need of column num1 the value ‘39’

I only get the column header but not the value I need from the column

The error was in the query, it should be done as follows:

" SELECT num1 FROM data.books where num3 = ‘ “+pp+” ’ "

you must indicate the position of the table to select the value the value of the table in our case “39”

str_output= Result.Rows(0).Item(0).ToString

Thanks for your help palaniyappan

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.