Drizin / DapperQueryBuilder

Dapper Query Builder using String Interpolation and Fluent API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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!

Thank you for your fine answer!