| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2616 人关注过本帖
标题:输入字符串格式不正确 确保方法参数的正确 将一个字符串装换为datatime,先分 ...
取消只看楼主 加入收藏
jackie6812
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2014-4-13
收藏
 问题点数:0 回复次数:0 
输入字符串格式不正确 确保方法参数的正确 将一个字符串装换为datatime,先分析该字符串以获取时间
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Globalization;


public partial class User_SearchResult : System.Web.UI.Page
{
    MangerClass mcObj = new MangerClass();
    UserInfoClass ucObj = new UserInfoClass();
    protected void Page_Load(object sender, EventArgs e)
    {
        dlSearchBind();
    }
    public string GetClass(int P_Int_ClassID)
    {
        string P_Str_ClassName = mcObj.GetClass(P_Int_ClassID);
        return P_Str_ClassName;
    }
    /// <summary>
    /// 显示指定类别的图书信息
    /// </summary>
    public void dlSearchBind()
    {
        ucObj.DCSearchBind(Request.QueryString["SearchName"].ToString(), "SearchName", DLsearch);
    }
    //绑定市场价格
    public string GetVarMKP(string P_Str_MarketPrice)
    {
        return ucObj.VarStr(P_Str_MarketPrice, 2);
    }
    //绑定会员价格
    public string GetVarMBP(string P_Str_MemberPrice)
    {
        return ucObj.VarStr(P_Str_MemberPrice, 2);
    }

    //当购买图书时,获取图书信息
    public SaveSubBookClass GetSubBookInformation(DataListCommandEventArgs e, DataList DLName)
    {
        //获取购物车中的信息
        SaveSubBookClass Book = new SaveSubBookClass();
        Book.BookID = int.Parse(DLName.DataKeys[e.Item.ItemIndex].ToString());
        string BookStyle = ();
        int index = BookStyle.IndexOf("|");
        if (index < -1 || index + 1 >= BookStyle.Length)
            return Book;
        Book.MemberPrice = float.Parse(BookStyle.Substring(index + 1));
        return (Book);
    }
    public void AddShopCart(DataListCommandEventArgs e, DataList DLName)
    {
        if (Session["UID"] != null)
        {
            SaveSubBookClass Book = null;
            Book = GetSubBookInformation(e, DLName);
            if (Book == null)
            {
                //显示错误信息
                Response.Write("<script>alert('没有可用的数据');</script>");
                return;
            }
            else
            {
                ucObj.AddShopCart(Book.BookID, Book.MemberPrice, Convert.ToInt32(Session["UID"].ToString()));
                Response.Write("<script>alert('恭喜您,添加成功!')</script>");
            }
        }
        else
        {
            Response.Write("<script>alert('请先登录,谢谢合作!');</script>");

        }

    }
    protected void DLsearch_ItemCommand(object source, DataListCommandEventArgs e)
    {
        if ( == "detailSee")
        {
            Session["address"] = "";
            Session["address"] = "SearchResult.aspx?SearchName=" + Convert.ToInt32(this.Request.QueryString["SearchName"].ToString());
            Response.Redirect("~/User/BookDetail.aspx?BookID=" + Convert.ToInt32(DLsearch.DataKeys[e.Item.ItemIndex].ToString()));
        }
        else if ( == "buyBook")
        {
            AddShopCart(e,DLsearch);
        }
    }
}
搜索更多相关主题的帖子: public 字符串 
2014-04-13 14:06
快速回复:输入字符串格式不正确 确保方法参数的正确 将一个字符串装换为datatim ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016895 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved