常用的3个模版
来源:互联网 发布:北京大数据工程师招聘 编辑:程序博客网 时间:2024/04/29 16:28
public SqlDataReader 方法名()
{
SqlConnection conn=new SqlConnection(ConfigurationSettings.AppSettings["ConnStr"]);
SqlCommand cmd=new SqlCommand("存储过程名",conn);
cmd.CommandType=CommandType.StoredProcedure;
cmd.Parameters.Add("@列名",参数);
conn.Open();
return cmd.ExecuteReader(CommandBehavior.CloseConnection);
}
public void 方法名()
{
SqlConnection conn=new SqlConnection(ConfigurationSettings.AppSettings["ConnStr"]);
SqlCommand cmd=new SqlCommand("存储过程名",conn);
cmd.CommandType=CommandType.StoredProcedure;
cmd.Parameters.Add("@列名",参数);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
}
public DataSet 方法名()
{
SqlConnection conn=new SqlConnection(ConfigurationSettings.AppSettings["ConnStr"]);
SqlDataAdapter da=new SqlDataAdapter("存储过程名",conn);
da.SelectCommand.CommandType=CommandType.StoredProcedure;
da.SelectCommand.Parameters.Add("@列名",参数);
DataSet ds=new DataSet();
da.Fill(ds);
return ds;
}
{
SqlConnection conn=new SqlConnection(ConfigurationSettings.AppSettings["ConnStr"]);
SqlCommand cmd=new SqlCommand("存储过程名",conn);
cmd.CommandType=CommandType.StoredProcedure;
cmd.Parameters.Add("@列名",参数);
conn.Open();
return cmd.ExecuteReader(CommandBehavior.CloseConnection);
}
public void 方法名()
{
SqlConnection conn=new SqlConnection(ConfigurationSettings.AppSettings["ConnStr"]);
SqlCommand cmd=new SqlCommand("存储过程名",conn);
cmd.CommandType=CommandType.StoredProcedure;
cmd.Parameters.Add("@列名",参数);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
}
public DataSet 方法名()
{
SqlConnection conn=new SqlConnection(ConfigurationSettings.AppSettings["ConnStr"]);
SqlDataAdapter da=new SqlDataAdapter("存储过程名",conn);
da.SelectCommand.CommandType=CommandType.StoredProcedure;
da.SelectCommand.Parameters.Add("@列名",参数);
DataSet ds=new DataSet();
da.Fill(ds);
return ds;
}
- 常用的3个模版
- 常用的3个模版
- 常用的3个模版
- 常用的3个模版
- 常用的makefile模版
- 一个常用的makefile模版
- php中smarty模版引擎中常用的20个变量操作符及使用方法!
- [转载]linux常用的makefile模版编写
- linux常用的makefile模版编写
- 一些常用mvc模版引擎的配置
- 转:linux常用的makefile模版编写
- linux常用的makefile模版编写
- linux常用的makefile模版编写
- linux常用的makefile模版编写
- linux常用的makefile模版编写
- 几种常用的模版类
- linux常用的makefile模版编写
- linux常用的makefile模版编写
- Wap页面使用asp.net中移动控件List分页
- Struts+Hibernate开发实践 分页的实现
- 如何取得IP/用户名等信息
- CTDP linux 程序员手册 C和C++编程(3)POSIX 功能性
- log4j 使用 简介
- 常用的3个模版
- Swing: Use Event-Specific Utilities
- 你的编程语言可以这样做吗?
- 最近做了一个网站
- 如何用T-SQL语句建立跟踪
- C#中获取程序当前路径的集中方法[转]
- C#中获取程序当前路径的集中方法[转]
- .NET]四种错误机制
- 分页的存储过程