Calling stored procedures with parameters in PetaPoco

前端 未结 3 1231
难免孤独
难免孤独 2021-02-04 01:59

I want to be able to call a stored proc with named parameters in PetaPoco.

In order to call a stored proc that does a search/fetch:

Can I do something like this

3条回答
  •  误落风尘
    2021-02-04 02:35

    In my case, I did the following

    db.EnableAutoSelect = false;
    
    return db.Fetch(@"EXEC SP_FindCust 
    @@first_name = @first_name, 
    @@last_name = @last_name, 
    @@dob = @dob", new {
      first_name = fName,
      last_name = lName,
      dob = dob
    });
    

    It worked!

提交回复
热议问题