Skip to content

Throwing error while calling procedure with empty datatable from entity framework to babelfish #97

@JayakumarEMIS

Description

@JayakumarEMIS

Hi @staticlibs, we encountered error in babelish while trying to call procedure with empty datatable from entity framework to babelfish got error, and it only accept if have data in that data table i have shared sample code and issue screen shot as well please check and provide solution for this,

and please note in sql server is working fine.

  try
            {
                DataTable dtClaimPayload1 = new DataTable();
                dtClaimPayload1.Columns.Add(new DataColumn("Request", typeof(string)));
                dtClaimPayload1.Columns.Add(new DataColumn("Id", typeof(int)));

                SqlParameter test = new SqlParameter("@claimDecompressedPayload", System.Data.SqlDbType.Structured)
                {
                    TypeName = "dbo.ClaimPayloadType"
                };
                //DataRow row1 = dtClaimPayload1.NewRow();
                //row1["Requestxmls"] = "hi";
                //row1["PrescriptionId"] = 1;
                //dtClaimPayload1.Rows.Add(row1);
                test.Value = dtClaimPayload1;
                var result1 = ExecStoredProcedure<ETPClaims1>("Data.Test", test).ToList();
            }
            catch(Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
CREATE TYPE dbo.ClaimPayloadType AS TABLE
(
    Request NVARCHAR(max),
    Id INT
)
CREATE PROCEDURE [Data].[Test] 
@claimDecompressedPayload dbo.ClaimPayloadType Readonly

AS
BEGIN
SELECT * FROM @claimDecompressedPayload
END

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixedThe bug was fixed in released version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions