| 论坛登陆 注册 | 教程 笑话 影视 投稿 |
![]() |
|
||||||||||||||||||||||||||||||||||||||||
WebServices调用存储过程 |
|
| www.xker.com 作者: 来源:csdn 加入日期:2006-4-10 10:33:21 | |
using System.Collections; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Web; using System.Web.Services; using System.Data.OleDb; using System.Web.Services.Protocols; namespace SFXTWebService { /// /// Service1 的摘要说明。 /// public class Service1 : System.Web.Services.WebService { public Service1() { //CODEGEN: 该调用是 ASP.NET Web 服务设计器所必需的 InitializeComponent(); } #region 组件设计器生成的代码 //Web 服务设计器所必需的 private IContainer components = null; /// /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// private void InitializeComponent() { } /// /// 清理所有正在使用的资源。 /// protected override void Dispose( bool disposing ) { if(disposing && components != null) { components.Dispose(); } base.Dispose(disposing); } #endregion // WEB 服务示例 // HelloWorld() 示例服务返回字符串 Hello World // 若要生成,请取消注释下列行,然后保存并生成项目 // 若要测试此 Web 服务,请按 F5 键 #region SFQD [WebMethod] public DataSet GetProcedureSFQD(string strp_lsh,out string strp_zt) { string strDBConnection = ""; strDBConnection = System.Configuration.ConfigurationSettings.AppSettings["ConnDBString"]; OleDbConnection oleConn = new OleDbConnection(strDBConnection); oleConn.Open(); OleDbCommand oleComm = new OleDbCommand("SFXT.SP_SF_BANK_SFQD",oleConn);//调用存储过程的方法 oleComm.CommandType = CommandType.StoredProcedure;//存储过程名称 try { //in参数 oleComm.Parameters.Add(new OleDbParameter("p_lsh",OleDbType.VarChar,50)).Value = strp_lsh; //out参数 oleComm.Parameters.Add(new OleDbParameter("p_zt",OleDbType.VarChar,50)); oleComm.Parameters["p_zt"].Direction = ParameterDirection.Output; oleComm.ExecuteNonQuery();//执行存储过程 //赋值 strp_zt = oleComm.Parameters["p_zt"].Value.ToString(); string str1 = oleComm.Parameters["p_zt"].Value.ToString(); DataSet ds = new DataSet(); DataTable table1 = new DataTable(); ds.Tables.Add(table1); ds.Tables[0].Columns.Add("p_zt"); DataRow dr = ds.Tables[0].NewRow(); dr[0] = str1; ds.Tables[0].Rows.Add(dr); return ds; } catch(Exception) { strp_zt = ""; return null; } 本新闻共2页,当前在第1页 1 2 编辑:xker.com上一篇:VC.NET扩展Windows磁盘清理工具的功能 下一篇:没有了 |
||
| 【关闭窗口】【技术交流】【收藏此页】 |
| 相关文章 | |||||
|
| 评论 | |
设为首页 - 版权声明 - 广告服务 - 关于我们 - 联系我们 - 友情连接 |
|
| Copyright © 2003-2006 xker.com All rights reserved.小新技术网 合作广告QQ:12231446 | |
|
|
| 本页浏览次数: |