JaCraig/SQLHelper

parameters with type 'text' not implemented

Joker926 opened this issue · 1 comments

Hi, my stored procedure is as follows
CREATE PROCEDURE DictioonaryObject_Insert
@object text,
@Guid uniqueidentifier
AS
BEGIN
insert into DictioonaryObject (DictionaryItem, [GUID]) values(@object,@Guid)
END
GO

C# code is
public async Task Insert(DictionaryItem item)
{
var json = JsonConvert.SerializeObject(item);
var jsonParam = new SQLHelperDB.HelperClasses.Parameter("object", json);
var guidParam = new SQLHelperDB.HelperClasses.Parameter("guid", item.Guid.Value);
var helper = Instance.AddQuery("DictioonaryObject_Insert", System.Data.CommandType.StoredProcedure, jsonParam, guidParam);
var resp = await helper.ExecuteScalarAsync();
}

Final Executible command is
exec sp_executesql N'DictioonaryObject_Insert
',N'@object nvarchar(205),@Guid uniqueidentifier',@object=N'{"Guid":"308ce82f-58bc-e911-80e7-00e081efd93c","ItemType":1,"ParentID":null,"Name":"kjfjkf","Description":"12321","HierarchiKey":null,"ChildCout":0,"Path":".308ce82f-58bc-e911-80e7-00e081efd93c","Level":1}',@Guid='308CE82F-58BC-E911-80E7-00E081EFD93C'

And Exception naturally:
Procedure or function 'DictioonaryObject_Insert' expects parameter '@object', which was not supplied.

That was actually an intentional choice when I made the library. Text, ntext, and image are going to be removed in future SQL Server versions. And my needs were more for nvarchar, varbinary, etc. so I never added in text.

If you'd like to make a fork, add the data type, etc. I'm more than happy to take the pull request.