[ASP.NET (C #)] The simplest storage process

xiaoxiao2021-03-06  100

SQL Server storage:

=======================================

CREATE Procedure AddNew

@Content Text

AS Insert Into Test Values ​​(@content)

Go

=======================================

CS call code:

=======================================

String sqlstring = "addnew";

SqlConnection conn = new sqlConnection (configurationSettings.appsettings ["sqlConnection"]);

Sqlcommand cmd = new sqlcommand (sqlstring, conn);

cmd.commandtype = commandtype.storedProcedure;

Sqlparameter param = new sqlparameter ();

Param = cmd.parameters.add ("@ Content", SqldbType.text);

Param.direction = parameterdirection.input;

Param.Value = "zzzzzzzzzzzzzzzzz";

Cn.open ();

cmd.executenonquery ();

cmd.dispose ();

CONN.CLOSE ();

Conn.dispose ();

====================================

转载请注明原文地址:https://www.9cbs.com/read-104706.html

New Post(0)