G
Guest
Dim da As New SqlDataAdapter("select * into #temp1 from tbl1 where ID = 9",
conn)
conn.open
da.selectcommand.commandtext = "select * from #temp1"
Dim dr As SqlDataReader = da.selectcommand.executereader
works OK ---- But
Dim da As New SqlDataAdapter("select * into #temp1 from tbl1 where ID =
@ID", conn)
da.selectcommand.Parameters.Add(new sqlparameter("@ID", sqldbType.Int, 2)
da.selectcommand.Parameters("@ID").value = 9
conn.open
da.selectcommand.commandtext = "select * from #temp1"
Dim dr As SqlDataReader = da.selectcommand.executereader
(nevermind the syntax above) - when I use a parameter and try to use a #temp
table - ado no longer recognizes the #temp table as when I just add the
criteria as part of the sql string. Is there a way to use parameters and use
#temp tables in the same queries?
Thanks,
Rich
conn)
conn.open
da.selectcommand.commandtext = "select * from #temp1"
Dim dr As SqlDataReader = da.selectcommand.executereader
works OK ---- But
Dim da As New SqlDataAdapter("select * into #temp1 from tbl1 where ID =
@ID", conn)
da.selectcommand.Parameters.Add(new sqlparameter("@ID", sqldbType.Int, 2)
da.selectcommand.Parameters("@ID").value = 9
conn.open
da.selectcommand.commandtext = "select * from #temp1"
Dim dr As SqlDataReader = da.selectcommand.executereader
(nevermind the syntax above) - when I use a parameter and try to use a #temp
table - ado no longer recognizes the #temp table as when I just add the
criteria as part of the sql string. Is there a way to use parameters and use
#temp tables in the same queries?
Thanks,
Rich