请问我在DATAGRID的链接列里面URL查询字符串设置这样:
shenyue_detail.aspx?f_value={0}&f_company="+this.DropDownList1 .SelectedItem .Text.ToString ()+"&f_year="+this.DropDownList2 .SelectedItem .Text.ToString()+"&f_month="+this.DropDownList3 .SelectedItem .Text.ToString()+"其中f_year,f_month是decimal类型的
在shenyue_detail.aspx页中
string x=this.Request .QueryString ["f_value"].ToString ();
string y=this.Request .QueryString ["f_company"].ToString ();
string z=this.Request .QueryString ["f_year"].ToString ();
string q=this.Request .QueryString ["f_month"].ToString ();
string conn1,command;
conn1 =" Persist Security Info = False ; User ID = libin ; Initial Catalog = changchun ; Data Source =localhost";
SqlConnection newconn = new SqlConnection(conn1);
newconn.Open ();
command = "SELECT * FROM "+x+" WHERE f_company='y' AND f_year='"+Convert.ToDecimal (z)+"' AND f_month='"+Convert.ToDecimal (q)+"'";
.........提示输入字符串的格式不正确。
行 45:
command = "SELECT * FROM "+x+" WHERE f_company='y' AND f_year='"+Convert.ToDecimal (z)+"' AND f_month='"+Convert.ToDecimal (q)+"'";请一定帮忙改一下,多谢了!!!!!!
shenyue_detail.aspx?f_value={0}&f_company="+this.DropDownList1 .SelectedItem .Text.ToString ()+"&f_year="+this.DropDownList2 .SelectedItem .Text.ToString()+"&f_month="+this.DropDownList3 .SelectedItem .Text.ToString()+"其中f_year,f_month是decimal类型的
在shenyue_detail.aspx页中
string x=this.Request .QueryString ["f_value"].ToString ();
string y=this.Request .QueryString ["f_company"].ToString ();
string z=this.Request .QueryString ["f_year"].ToString ();
string q=this.Request .QueryString ["f_month"].ToString ();
string conn1,command;
conn1 =" Persist Security Info = False ; User ID = libin ; Initial Catalog = changchun ; Data Source =localhost";
SqlConnection newconn = new SqlConnection(conn1);
newconn.Open ();
command = "SELECT * FROM "+x+" WHERE f_company='y' AND f_year='"+Convert.ToDecimal (z)+"' AND f_month='"+Convert.ToDecimal (q)+"'";
.........提示输入字符串的格式不正确。
行 45:
command = "SELECT * FROM "+x+" WHERE f_company='y' AND f_year='"+Convert.ToDecimal (z)+"' AND f_month='"+Convert.ToDecimal (q)+"'";请一定帮忙改一下,多谢了!!!!!!
command = "SELECT * FROM "+x+" WHERE f_company='y' AND f_year='"+z+"' AND f_month='"+q+"'";
用这句command = "SELECT * FROM "+x+" WHERE f_company='y' AND f_year='"+z+"' AND f_month='"+q+"'";
提示:将 varchar 转换为数据类型 numeric 时发生算术溢出错误。是不是URL设置有问题啊??
在查询分析器中很快就可以试出正确的写法!
应该是类型不对,
<Columns>
<asp:TemplateColumn HeaderText="Sample Column">
<ItemTemplate>
<asp:Hyperlink runat="server" Text='<%#Container.DataItem("TextVal")%>' NavigateUrl='<%# "page.aspx?Param1=" & Server.UrlEncode(Container.DataItem("Val1")) & "&Param2=" & Server.UrlEncode(Container.DataItem("Val2"))%>'/>
</ItemTemplate>
</asp:TemplateColumn></Columns>