说白了就是存储语句的问题吧? DataView CreateDataSource()
{
string nowDSN=ConfigurationSettings.AppSettings["data"];
SqlConnection myConnection=new SqlConnection(nowDSN);
SqlDataAdapter myCommand=new SqlDataAdapter("look6", myConnection);
myCommand.SelectCommand.Parameters.Add(new SqlParameter("@radio", SqlDbType.Char));
myCommand.SelectCommand.Parameters["@radio"].Value = Request.QueryString["radio"];
myCommand.SelectCommand.CommandType=CommandType.StoredProcedure; DataSet ds = new DataSet();
myCommand.Fill(ds, "qarpt");
MyList.DataSource = ds.Tables["qarpt"].DefaultView;
MyList.DataBind();
return ds.Tables["qarpt"].DefaultView;
} --------------------------------------------------------------------<Columns><asp:BoundColumn ItemStyle-Width="30px" HeaderText="序号" DataField="poseq" runat="server" />
<asp:TemplateColumn HeaderText="采购单号">
<ItemStyle width="40">
</ItemStyle>
<ItemTemplate>
<asp:HyperLink Text='<%# FormatString(DataBinder.Eval(Container.DataItem,"pono").ToString())%>' NavigateUrl='<%# "javascript:newwin(\"look4.aspx?pono="+DataBinder.Eval(Container.DataItem,"pono").ToString()+"\");" %>' runat="server"/>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn ItemStyle-Width="300px" HeaderText="料品名称/规格" DataField="specification" runat="server" />
</Columns>-----------------------------------------------------CREATE procedure look6
(
@radio nvarchar(50)=null
)
as
begin
declare
@sql1 nvarchar(100),
@sql2 nvarchar(100)
set @sql1 = 'select count(*) as co from qarpt where id is not null '
set @sql2 = 'select * from qarpt where id is not null '
if(@radio is not null)
begin
set @sql1 = @sql1 + ' and radio =''' + @radio + ''''
set @sql2 = @sql2 + ' and radio =''' + @radio + ''''
end
execute(@sql1)
end
GO
{
string nowDSN=ConfigurationSettings.AppSettings["data"];
SqlConnection myConnection=new SqlConnection(nowDSN);
SqlDataAdapter myCommand=new SqlDataAdapter("look6", myConnection);
myCommand.SelectCommand.Parameters.Add(new SqlParameter("@radio", SqlDbType.Char));
myCommand.SelectCommand.Parameters["@radio"].Value = Request.QueryString["radio"];
myCommand.SelectCommand.CommandType=CommandType.StoredProcedure; DataSet ds = new DataSet();
myCommand.Fill(ds, "qarpt");
MyList.DataSource = ds.Tables["qarpt"].DefaultView;
MyList.DataBind();
return ds.Tables["qarpt"].DefaultView;
} --------------------------------------------------------------------<Columns><asp:BoundColumn ItemStyle-Width="30px" HeaderText="序号" DataField="poseq" runat="server" />
<asp:TemplateColumn HeaderText="采购单号">
<ItemStyle width="40">
</ItemStyle>
<ItemTemplate>
<asp:HyperLink Text='<%# FormatString(DataBinder.Eval(Container.DataItem,"pono").ToString())%>' NavigateUrl='<%# "javascript:newwin(\"look4.aspx?pono="+DataBinder.Eval(Container.DataItem,"pono").ToString()+"\");" %>' runat="server"/>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn ItemStyle-Width="300px" HeaderText="料品名称/规格" DataField="specification" runat="server" />
</Columns>-----------------------------------------------------CREATE procedure look6
(
@radio nvarchar(50)=null
)
as
begin
declare
@sql1 nvarchar(100),
@sql2 nvarchar(100)
set @sql1 = 'select count(*) as co from qarpt where id is not null '
set @sql2 = 'select * from qarpt where id is not null '
if(@radio is not null)
begin
set @sql1 = @sql1 + ' and radio =''' + @radio + ''''
set @sql2 = @sql2 + ' and radio =''' + @radio + ''''
end
execute(@sql1)
end
GO
解决方案 »
- C# Winform中很简单的问题,怎样设置用ShowDialog显示的子窗口在父窗口中的位置
- 在线程中使用控件怎么处理
- 使用webBrowser做的浏览器 安装activex插件问题
- C#类,跪求帮助
- (急)关于DataGridView中数据读取问题,如果点击DGV中的数据后,怎么把对应行的数据读取出来呢?(里面有详细的问题说明)
- 推荐一个vs2005的下载地址————速度很快——不要错过哦
- @@@送分快来抢:web程序和windows程序的事件机制有哪些本质区别?
- WINDOWS 下DATAGRID的问题
- 求教!如何获得句柄!!
- 求C#入门电子教程
- 路过的GGJJ,小弟求:复合查找的存储语句和程序
- GGJJ:如果我要发送很多邮件,并且邮件箱不是下面代码里固定的邮箱,那么我该怎么循环发送邮件给不同的邮箱?
换成
execute(@sql2)
换成
execute(@sql2)正点