AndrewdAzotus
Member
- Joined
- Aug 8, 2012
- Messages
- 22
- Programming Experience
- 10+
For those that have far greater experience with VB and SQL Server than I, I wondered if this is bad:
Dim SQLCmd As New SqlCommand("Select Descr from yModList Where Idx = " & New SqlCommand("Select Max(Idx) from yModList", Cxn).ExecuteScalar, Cxn)
and (more importantly) Why?
I have a table called yModList with two columns: Idx (int and pri-key) and Descr (string)
the idea of this SQLCmd is to extract the Descr from the row where Idx is the highest value. It seems fairly obvious to me but I wondered if there would be any hidden issues...
Dim SQLCmd As New SqlCommand("Select Descr from yModList Where Idx = " & New SqlCommand("Select Max(Idx) from yModList", Cxn).ExecuteScalar, Cxn)
and (more importantly) Why?
I have a table called yModList with two columns: Idx (int and pri-key) and Descr (string)
the idea of this SQLCmd is to extract the Descr from the row where Idx is the highest value. It seems fairly obvious to me but I wondered if there would be any hidden issues...