唉,实现说一下我是新手,用VB正,所以希望能给VB能用的回答,谢谢了 <asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:workConnectionString %>"
SelectCommand="SELECT workcontent AS 工作内容, workschedule AS 工作进度, res AS 备注, DataAndTime AS 时间, id AS 姓名 FROM work where [id] Like '%<%=user1%>%'" >
</asp:SqlDataSource>我调用不了user1这个后台变量 ,查询结果为空,直接在代码里写出条件,就可以显示出来
ConnectionString="<%$ ConnectionStrings:workConnectionString %>"
SelectCommand="SELECT workcontent AS 工作内容, workschedule AS 工作进度, res AS 备注, DataAndTime AS 时间, id AS 姓名 FROM work where [id] Like '%<%=user1%>%'" >
</asp:SqlDataSource>我调用不了user1这个后台变量 ,查询结果为空,直接在代码里写出条件,就可以显示出来
谁教你在这里写sql语句啊?
在后台写啊,或者在配置数据源的时候设置啊
加了个SqlDataSource控件,数据绑定的时候自己加上去的不知道怎么在后台写,我是新手啊
ConnectionString="<%$ConnectionStrings:conn %>"
SelectCommand="SELECT workcontent AS 工作内容, workschedule AS 工作进度, res AS 备注, DataAndTime AS 时间, id AS 姓名 FROM work where [id] Like '%'+@user1 +'%'">
</asp:SqlDataSource> this.SqlDataSource1.SelectParameters.Add("user1", "123");
123是干嘛用的? C# 啊,不知道VB能用不
错误 11 类型“String”的值无法转换为“System.Web.UI.WebControls.Parameter”。 C:\Users\laihuchun\Documents\Visual Studio 2008\Projects\work\work\post_work.aspx.vb 50 45 Work
我把条件直接写进SQL语句里可以查出数据的
SelectCommand="SELECT [ID], [NAME] WHERE ([ID] = @ID)">
<SelectParameters>
<asp:Parameter DefaultValue="1" Name="ID" Type="Decimal" />
</SelectParameters>
</asp:SqlDataSource>
this.SqlDataSource1.SelectParameters["ID"].DefaultValue = "2";
this.SqlDataSource1.DataBind();
this.GridView1.DataBind();
有一个拼写错误,谢谢他说的跟踪方法感谢大家不嫌弃俺是新手的热心指教~
如list.aspx?user1=liming