Dapper Post Data

1-)

public IDbConnection Connection

{

get

{

return new SqlConnection(ConfigurationManager.ConnectionStrings[“myconnectstring”].ConnectionString);

}

}

2-)

using (IDbConnection cn = Connection)

{

cn.Open();

foreach (var item in userReports)

{

DynamicParameters objParm = new DynamicParameters();

objParm.Add(“@productCode”, item.ProductCode);

objParm.Add(“@productName”, item.ProductName);

objParm.Add(“@companyId”, item.CompanyId);

objParm.Add(“@message”, dbType: DbType.String, direction: ParameterDirection.Output,size:600);

cn.Execute(“rpt_InsertCategory”, objParm, commandType: CommandType.StoredProcedure);

string result= objParm.Get<string>(“message”);

if (result!=null && result!= “successfull”)

{

if (result.Length > 0)

{

return Json(“Error occurred. Error details: “ + result);

}

}

}

cn.Close();

}

3-)

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

create PROCEDURE [dbo].[rpt_InsertCategory]

@productCode nvarchar(50) ,

@productName nvarchar(150) ,

@message varchar(600) output

as

begin

SET NOCOUNT ON;

set @message=’successfull’

— -bla

— bla

end

--

--

--

Full Stack Developer

Recommended from Medium

ARKit 101: How to Build Augmented Reality (AR) based resume using Face Recognition

Building your first REST API using Java 11, Spring-boot, Gradle 7, and IntelliJ 2021

House vs Code cleaning

Showcase Your Widget with Flutter Widgets Explorer

Seven Q&As for Developers: What Is Productization

Why Competitive E-Commerce Companies Rotate IP Addresses

Kubernetes Tip: How To Co-locate Applications On The Same Node?

Udacity Robotics Nanodegree Review: A personal lesson in failure

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
ilhan DEMİRTEPE

ilhan DEMİRTEPE

Full Stack Developer

More from Medium

Why (de)normalize data

Best Books/Resources to Learn QlikView & QlikSense🌿

A Step By Step Guide to Writing Research Papers

Scripting the Unscripted