GetSchemaTable with subquery couldn't return basetablename

?

???Q

as title said ,
I run code below , the column(a1ap6d1.in_seq) from subquery
could not return basetablename but null
I realize that using join syntax could ,
but subquery is popular syntax ,
is there any way to get correct basetablename when a query contain
subquery?


Dim rdr As SqlDataReader, dsa As String
da1.SelectCommand = New SqlCommand("select *,(select top 1
in_seq from a1ap6d1 where in_id=a.in_id) as in_seq from a1ap6h a",
conn)
rdr = da1.SelectCommand.ExecuteReader(CommandBehavior.KeyInfo)
Dim tbl As DataTable = rdr.GetSchemaTable()
Dim row As DataRow
rdr.Close()
For Each row In tbl.Rows
dsa = row("BaseTableName")
Next
 
M

Miha Markic [MVP C#]

Hi,

Why do you need it in first place?
Since you are executing the query you probably know which table are you
querying...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top