一个简单的存储过程问题,大家帮帮忙啊!
使用存储过程显示数据和插入记录我都实现了.怎么实现用存储过程查询和更新记录呢??
查询存储过程:
CREATE PROCEDURE dbo.selectnews
@id int
as
select * from news where id=@id
GO
更新存储过程:
CREATE PROCEDURE dbo.selectnews
@id int,
@title varchar(100)
as
update news set title=@title where id=@id
GO
我写的显示数据的ASP.NET代码:
conn.Open();
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = new SqlCommand();
da.SelectCommand.Connection = conn;
da.SelectCommand.CommandText = "dt_newsshow";
da.SelectCommand.CommandType = CommandType.StoredProcedure;
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
请问大家怎么写查询和更新的ASP.NET代码呀??弄了很长时间了呀,大家帮帮我吧,谢谢!!!!