--例子--创建测试表 create table tb(id int identity(1,1),txt text)go --创建存储的存储过程 create proc p_save @txt text as insert into tb values(@txt) go--调用存储过程保存 exec p_save ' \''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1T:\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1P:\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1R:\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1Bp: \par \''a1\''a1\''a1\''a1\''c9\''f1\''d6\''be\''c7\''e5\''b3\''fe\''a3\''ac\''be\''ab\''c9\''f1\''c6\''a3\''be\''eb\''a3\''ac\''b7\''a2\''d3\''fd\''d5\''fd\''b3\''a3\''a3\''ac\''d3\''aa\''d1\''f8\''d6\''d0\''b5\''c8\''a3\''ac\''b2\''bd\''d0\''d0\ '--显示结果 select * from tbgo --删除测试环境 drop table tb drop proc p_save
'程序中的调用方法,以VB为例子:Dim iCmd As ADODB.Command Dim iRe&Set iCmd = New ADODB.Command With iCmd .ActiveConnection = 数据库连接字符串 .CommandType = adCmdStoredProc .CommandText = "p_save" .Parameters.Refresh .Parameters("@txt") =你要存储的字符串,可以是控件的属性 .Execute MsgBox "保存成功" End With
create table tb(id int identity(1,1),txt text)go
--创建存储的存储过程
create proc p_save
@txt text
as
insert into tb values(@txt)
go--调用存储过程保存
exec p_save '
\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1T:\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1P:\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1R:\''a1\''a1\''a1\''a1\''a1\''a1\''a1\''a1Bp:
\par \''a1\''a1\''a1\''a1\''c9\''f1\''d6\''be\''c7\''e5\''b3\''fe\''a3\''ac\''be\''ab\''c9\''f1\''c6\''a3\''be\''eb\''a3\''ac\''b7\''a2\''d3\''fd\''d5\''fd\''b3\''a3\''a3\''ac\''d3\''aa\''d1\''f8\''d6\''d0\''b5\''c8\''a3\''ac\''b2\''bd\''d0\''d0\
'--显示结果
select * from tbgo
--删除测试环境
drop table tb
drop proc p_save
Dim iRe&Set iCmd = New ADODB.Command
With iCmd
.ActiveConnection = 数据库连接字符串
.CommandType = adCmdStoredProc
.CommandText = "p_save"
.Parameters.Refresh
.Parameters("@txt") =你要存储的字符串,可以是控件的属性
.Execute
MsgBox "保存成功"
End With
http://expert.csdn.net/Expert/topic/2303/2303308.xml?temp=.6751825