title: "System.Data.SqlClient.SqlException: Could not find stored procedure" even though the procedure is there
body: <p>So I'm learning how to use Selenium to test a project and I want to compare the value in stored procedure with the inputs. I have check the stored procedure (XE_SEARCH) and don't know what is wrong with it that make me have this error. I tried using another procedure (CM_XE_Search, this is an old one we're no longer use it) in the same database and it worked fine. I've included pics so you can look at the problem better.Can someone help me with this? Thank you very much.</p>
  
  <p><a href="https://i.stack.imgur.com/kRieQ.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p><a href="https://i.stack.imgur.com/q3YLf.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p><a href="https://i.stack.imgur.com/PKill.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p><a href="https://i.stack.imgur.com/mcnzX.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>Here is the code</p>
  
  <pre><code>using System;
  using Microsoft.VisualStudio.TestTools.UnitTesting;
  using OpenQA.Selenium;
  using OpenQA.Selenium.Chrome;
  using System.Linq;
  using Group11.XE.Test.XEDTO;
  using OpenQA.Selenium.Support.UI;
  using OpenQA.Selenium.Interactions;
  using System.Threading;
  using Group11.XE.Test.Helper;
  
  
  namespace Group11.XE.Test
  {
      [TestClass]
      public class CreateXE : Load
      {
  
          public CreateXE()
          {
              driver = new ChromeDriver();
              homeURL = "http://localhost:4200";
  
          }
  
          [TestMethod]
          [DataRow("Exciter", "Đen", 2, "Ex 150", "71C4-45677", 42000000, 2, "Xe vua mua", 135,"Yamaha", 2019)]
          public void Create_XE_With_OK_Status(String Name, String Color, int Seats, String Model, String License, int Price, int Consumption, String Notes, int Mspeed, String Manufacturer, int Manufacture_year)
          {
              String Code = (new Random().Next(1, 99999999)).ToString();
  
  
              Login();
  
              driver.Navigate().GoToUrl(homeURL + "/app/admin/xe-group11-add");
              driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(7);
              WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(60));
              wait.Until(e =&gt; e.FindElement(By.Name("xE_CODE")));
              Thread.Sleep(8000);
  
              //Act;
              driver.FindElement(By.Name("xE_CODE")).SendKeys(Code);
              driver.FindElement(By.Name("xE_NAME")).SendKeys(Name);
              driver.FindElement(By.Name("xE_COLOR")).SendKeys(Color);
              driver.FindElement(By.Name("xE_SEATS")).SendKeys(Seats.ToString());
              driver.FindElement(By.Name("xE_MODEL")).SendKeys(Model);
              driver.FindElement(By.Name("xE_LICENSE_PLATE")).SendKeys(License);
              driver.FindElement(By.Name("xE_PRICE")).SendKeys(Price.ToString());
              driver.FindElement(By.Name("xE_CONSUMPTION")).SendKeys(Consumption.ToString());
              driver.FindElement(By.Name("xE_NOTES")).SendKeys(Notes);
              driver.FindElement(By.Name("xE_MAX_SPEED")).SendKeys(Mspeed.ToString());
              driver.FindElement(By.Name("xE_MANUFACTURER")).SendKeys(Manufacturer);
              driver.FindElement(By.Name("xE_MANUFACTURE_YEAR")).SendKeys(Manufacture_year.ToString());
              //driver.FindElement(By.Name("xE_STATUS")).SendKeys(Status);
  
              IWebElement comboBox = driver.FindElement(By.Name("xE_STATUS"));
              SelectElement selectedValue = new SelectElement(comboBox);
              selectedValue.SelectByIndex(0);
              String Status = selectedValue.ToString();
  
              //get value of select element
  
  
  
              IWebElement ele = driver.FindElement(By.XPath("/html/body/app-root/ng-component/div/div/div[2]/ng-component/form/ul/li[1]"));
              IJavaScriptExecutor executor = (IJavaScriptExecutor)driver;
              executor.ExecuteScript("arguments[0].click();", ele);
  
  
              //Check with value of DB
              //CM_XE_DTO input = new CM_XE_DTO(Code, Name, Origin);
              XE_DTO finalRow = DataProvider.Instance.GetData&lt;XE_DTO&gt;("XE_SEARCH", new { XE_CODE = Code, XE_Name = Name, XE_COLOR = Color, XE_SEATS = Seats, XE_MODEL = Model, XE_LICENSE_PLATE = License, XE_PRICE = Price, XE_CONSUMPTION = Consumption, XE_NOTES = Notes, XE_MAX_SPEED = Mspeed, XE_MANUFACTURER = Manufacturer, XE_MANUFACTURE_YEAR = Manufacture_year, XE_STATUS = Status }).ToList().FirstOrDefault();
  
              //Assert
              Assert.AreEqual(Code, finalRow.XE_CODE);
              Assert.AreEqual(Name, finalRow.XE_NAME);
              Assert.AreEqual(Color, finalRow.XE_COLOR);
              Assert.AreEqual(Seats, finalRow.XE_SEATS);
              Assert.AreEqual(Model, finalRow.XE_MODEL);
              Assert.AreEqual(License, finalRow.XE_LICENSE_PLATE);
              Assert.AreEqual(Price, finalRow.XE_PRICE);
              Assert.AreEqual(Consumption, finalRow.XE_CONSUMPTION);
              Assert.AreEqual(Notes, finalRow.XE_NOTES);
              Assert.AreEqual(Mspeed, finalRow.XE_MAX_SPEED);
              Assert.AreEqual(Manufacturer, finalRow.XE_MANUFACTURER);
              Assert.AreEqual(Manufacture_year, finalRow.XE_MANUFACTURE_YEAR);
              Assert.AreEqual(Status, finalRow.XE_STATUS);
  
              driver.Close();
  
          }
  }
  </code></pre>
  
  <p>Data Provider</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Data;
  using System.Data.SqlClient;
  using System.Linq;
  using System.Text;
  using Dapper;
  using Group11.XE.Test.Helper.DTO;
  
  namespace Group11.XE.Test.Helper
  {
      class DataProvider
      {
          private static DataProvider instance;
  
          private DataProvider() { }
          internal static DataProvider Instance
          {
              get
              {
                  if (instance == null)
                  {
                      instance = new DataProvider();
                  }
                  return instance;
              }
  
              private set =&gt; instance = value;
          }//Cap Instance
          string conection = "Server=tcp:quanlitaisan.database.windows.net,1433;Initial Catalog=QuanLiTaiSan;Persist Security Info=False;User ID=QLTS_Dev;Password=******;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;";
  
  
  
          private List&lt;ProcedureParamInfo&gt; GetParamInfos(IDbConnection conn, string procedureName)
          {
              var rr = conn.Query&lt;ProcedureParamInfo&gt;($"select PARAMETER_NAME, PARAMETER_MODE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH from information_schema.parameters where specific_name = '{procedureName}'");
              return rr.ToList();
          }
  
          public List&lt;T&gt; GetData&lt;T&gt;(string procedureName, object parameter)
          {
              List&lt;T&gt; result;
  
              using (IDbConnection con = new SqlConnection(conection))
              {
                  if (con.State == ConnectionState.Closed)
                      con.Open();
  
                  var paramsInfo = GetParamInfos(con, procedureName);
  
                  DynamicParameters parameters = new DynamicParameters();
  
                  var properties = parameter.GetType().GetProperties();
  
                  foreach (var param in paramsInfo)
                  {
                      var property = properties // nsx_code == nsx_code
                                      .Where(x =&gt; x.Name.ToLower() == param.PARAMETER_NAME.Replace("@", "").ToLower())
                                      .FirstOrDefault();
                      if (property == null)
                      {
                          continue;
                      }
                      var debug1 = property.GetValue(parameter);
                      parameters.Add(param.PARAMETER_NAME, property.GetValue(parameter));
                  }
  
                  result = con.Query&lt;T&gt;(procedureName, parameters, null, true, null, System.Data.CommandType.StoredProcedure).ToList();
              }
  
              return result;
          }
      }
  }
  </code></pre>