本文介绍了请帮我在c#中编写storedprocedure调用函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 大家好, i在sql server2008中创建了一个存储过程并成功执行... 现在我想通过c#windows应用程序执行该存储过程... 。 i在互联网上看了一些代码示例,他们为插入,更新和删除采用了三种不同的存储过程。但我在一个存储过程中进行了三次操作... 我在sql中为存储过程编写的代码是...... go 创建 procedure MasterInsertUpdateDelete ( @ sno 整数, @ name varchar ( 50 ), @ phone bigint , @ city varchar ( 50 ), @ statementType nvarchar ( 20 )= ' ' ) as 开始 如果 @ statementType = ' 插入' 开始 将插入 chaitu(sno,name,phone,city) values ( @ sno , @ name , @ phone , @ city ) end if @ statementType = ' 选择' 开始 选择 * 来自 chaitu end if @ statementType = ' 更新' 开始 update chaitu set name = @ name,phone = @ phone,city = @ city 其中 sno = @ sno end else if @ statementType = ' 删除' 开始 delete 来自 chaitu 其中 sno = @ sno end end 我应该在c#windows中编写什么代码表单调用这个storedprocedure ...我有三个不同的按钮插入,更新,删除。 他们每个应该执行使用这个单独的存储过程来完成各自的任务.... 请帮助我... 解决方案 hi guys,i created a stored procedure in sql server2008 and executed successfully...now i want to execute that stored procedure through c# windows application....i looked some code examples in internet there they took three different stored procedures for insert, update and delete. but i took three operations in a single stored procedure...the code i written for stored procedure in sql is...gocreate procedure MasterInsertUpdateDelete(@sno integer,@name varchar(50),@phone bigint,@city varchar(50),@statementType nvarchar(20)='')asbeginif @statementType= 'Insert'begininsert into chaitu (sno, name, phone, city) values(@sno, @name, @phone, @city)endif @statementType='Select'beginselect * from chaituendif @statementType='Update'beginupdate chaitu set name=@name, phone=@phone, city=@citywhere sno=@snoendelse if @statementType='Delete'begindelete from chaitu where sno=@snoendendwhat code should i have to write in c# windows form to call this storedprocedure... and i have three different buttons "Insert", "Update", "Delete".each of them should perform their respective tasks, using this single stored procedure....please help me... 解决方案 这篇关于请帮我在c#中编写storedprocedure调用函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-21 05:18