SQL server存储:
======================================
CREATE PROCEDURE AddNew
@content text
AS insert into test values (@content)
GO
======================================
CS调用代码:
======================================
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= "zzzzzzzzzzzzzzz";
conn.Open();
cmd.ExecuteNonQuery();
cmd.Dispose();
conn.Close();
conn.Dispose();
===================================
本文地址:http://com.8s8s.com/it/it8333.htm