asp.net(c#) 下SQL存储过程使用详细实例
记取记录集
create procedure getArticle
as
select * from Article_Content
GO
asp.net 调用方法
SqlConnection Conn = new SqlConnection();
Conn.ConnectionString = Data.Connstr();
Conn.Open();
SqlDataAdapter sdr=new SqlDataAdapter();
sdr.SelectCommand = new SqlCommand("getArticle", Conn);
sdr.SelectCommand.CommandType=CommandType.StoredProcedure;
DataSet rs = new DataSet();
sdr.Fill(rs);
sdr.Dispose();
Conn.Dispose();
Response.Write(rs.Tables[0].Rows.Count);
-------------------------------------------------------------------------------------
删除记录(带输入参数)
create procedure DelArticle
@Id int
as
delete from Article_Content where Id=@Id
GO
asp.net调用方法
if (Request.QueryString["Id"] != null)
{
SqlConnection Conn = new SqlConnection();
Conn.ConnectionString = Data.Connstr();
Conn.Open();
SqlCommand cmd = new SqlCommand("DelArticle", Conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@Id", SqlDbType.Int,4).Value = int.Parse(Request.QueryString["Id"].ToString());
&
相关文档:
Row内找Label控件
//内部控件事件
protected void LinkButton11_Click1(object sender, EventArgs e)
{
//删除对应的事务
int ......
使用VB把Excel导入到Sql数据库中,其实有几种方法。
下面我介绍的这种方法,较为简单。
其实这种方法的话,是直接使用T-SQL操作的,因此,到了VB里面,直接eccute这个代码就OK了的。
-----------------------------------------------------下面是在T-sql中的语句
if object_id('NewTable') is not null/*判断表NewTabl ......
窗体代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using AgentObjects;
using SpeechLib;
using System.Web;
using System.Threading;
using System.Text.RegularExpressio ......