Question Need help in SQL format please

musimu

New member
Joined
Apr 14, 2023
Messages
3
Programming Experience
Beginner
Below is a SQL sql query that I want to run in vb.net. How should I be writing this SQL to be accepted in VB.net please?

Select
F.CF_ITEM_NAME As Folder_Name,
r.RN_CYCLE_ID As Test_Set_Id,
t.ts_name As Instance,
"test_set_folder"."CF_ITEM_NAME" AS "Test Set Folder 1",
"test_set"."CY_CYCLE" AS "Tet Set Folder Name"

from Step s,Test t, cycle c, cycl_fold f, Testcycl TC,(select rn_testcycl_id, max(rn_run_id) As max_run_id from run group by rn_testcycl_id)r1 ,
RUN r
RIGHT JOIN TESTCYCL "test_instance" ON "test_instance"."TC_TESTCYCL_ID" = r."RN_TESTCYCL_ID"
RIGHT JOIN CYCLE "test_set" ON "test_set"."CY_CYCLE_ID" = "test_instance"."TC_CYCLE_ID"
INNER JOIN CYCL_FOLD "test_set_folder" ON "test_set_folder"."CF_ITEM_ID" = "test_set"."CY_FOLDER_ID"
LEFT JOIN CYCL_FOLD "test_set_folder1" ON "test_set_folder1"."CF_ITEM_ID" = "test_set_folder"."CF_FATHER_ID"

Where t.ts_test_id = s.st_test_id
and s.st_run_id = r.rn_run_id
and r.rn_run_id = r1.max_run_id
and r.rn_testcycl_id = r1.rn_testcycl_id
and r.rn_execution_date >'01-JAN-2022'
 
The help I need is to convert above listed SQL to be inserted in vb.net with aliases for column and table. Im not able to convert or implement in vb.net. I did on best of my knowledge but the failed to run SQL. Note: The SQL has no issue itself.
 
If the SQL code works but the VB doesn't then you need to show us the VB, not the SQL. You need to show us what you did and tell us what happened when you did it. We need to see the actual problem we're trying to solve.
 
the query fails to execute at "RecSet = com.Execute" when I have string strReqQuery value as below. Is mt syntax of strReqQuery correct as per vb.net?

Above given query runs without fail outside of vb.net meaning no issue to run in 3rd party tools like "Oracle SQL developer"
Im having challenge in converting my SQL query to insert as string to accept in vb.net.

dim strReqQuery , tdc, com
strReqQuery = "select F.CF_ITEM_NAME , r.RN_CYCLE_ID,t.ts_name, test_set_folder.CF_ITEM_NAME,test_set.CY_CYCLE from Step s,Test t,cycle c,cycl_fold cf,Testcycl tc,(select rn_testcycl_id, max(rn_run_id) from run group by rn_testcycl_id) r1, RUN r RIGHT JOIN TESTCYCL tc ON tc.TC_TESTCYCL_ID = r.RN_TESTCYCL_ID RIGHT JOIN CYCLE c ON c.CY_CYCLE_ID = tc.TC_CYCLE_ID INNER JOIN CYCL_FOLD ON cf.CF_ITEM_ID = c.CY_FOLDER_ID Where t.ts_test_id = s.st_test_id and s.st_run_id = r.rn_run_id and r.rn_run_id = r1.max_run_id and r.rn_testcycl_id = r1.rn_testcycl_id and r.rn_execution_date >'01-JAN-2022'
com = tdc.Command
com.CommandText = strReqQuery
RecSet = com.Execute
 
Back
Top