Temp table not exists
Broderick890 opened this issue · comments
Hi there! I found strange situation,the last code will throw exception #tmp table not found.
using SqlConnection conn = new SqlConnection(connectionString);
conn.Open();
int i = 0;
QueryBuilder builder = conn.QueryBuilder($@"
if 1={i}
begin
select 'exit'
return
end
create table #tmp(id nvarchar(50));");
var yy= builder.Execute();
builder = conn.QueryBuilder($"insert into #tmp(id) values('test')");
var rst = builder.Execute(); // <--- throws exception
Thank you!
Check out this answer:
https://stackoverflow.com/a/40648178
Thank you for your fine answer!