I am completely new to C#, T-SQL, and Dapper and was trying to execute a stored procedure, but I am getting
System.Data.SqlClient.SqlException: Incorrect syntax around 'Josh'
My stored procedure is simply:
CREATE PROCEDURE [compName\Josh].[josh_test_insert]
@ssn FLOAT,
@gpa FLOAT
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO [compName\Josh].josh_testing
VALUES (@ssn, @gpa);
END
GO
Where josh_testing has two fields of SSN and GPA.
The C# code is
public void InsertPerson(float ssn, float gpa)
{
using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Helper.CnnVal("SampleDB")))
{
List<new_app> apps = new List<new_app>();
apps.Add(new new_app { ssn = ssn, gpa = gpa });
connection.Execute("compName\\Josh.josh_test_insert @ssn, @gpa",apps);
}
}
Anyone know what I'm missing here?