网格视图问题在这里 [英] grid view problem mension here

查看:79
本文介绍了网格视图问题在这里的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

using System;
using System.Collections;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OracleClient;
using System.Data;
using System.Collections.Generic;
using System.Linq;

public partial class page_gridview : System.Web.UI.Page
{
    string strcon = ConfigurationManager.ConnectionStrings["oracle"].ConnectionString;
    SqlDataSource sdc = null;
    string strselect = "select customer_name,product,quantity,price,date_info from db_list";
    protected void page_Init(object sender, EventArgs e)
    {
        sdc = new SqlDataSource(strcon, strselect);
        sdc.ID = "sdc";
        sdc.DeleteCommand = "delete from db_list where customer_name=:p_customer_name";
        sdc.DeleteParameters.Add(new Parameter("customer_name", TypeCode.String));

        sdc.UpdateCommand = "update db_list set product=:p_product,quantity=:p_quantity,price=:p_price,date_info=:p_date_info where customer_name=:p_customer-name";
        sdc.UpdateParameters.Add(new Parameter("customer_name", TypeCode.String));
        sdc.UpdateParameters.Add(new Parameter("product", TypeCode.String));
        sdc.UpdateParameters.Add(new Parameter("quantity", TypeCode.Decimal));
        sdc.UpdateParameters.Add(new Parameter("price", TypeCode.Decimal));
        sdc.UpdateParameters.Add(new Parameter("date_info", TypeCode.DateTime));
        Form.Controls.Add(sdc);
        GridView1.DataSourceID = "sdc";         
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GridView1.DataBind();
        }

    }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        DataKey key = GridView1.SelectedDataKey;
        Response.Write("Selected customer name ::"+key.Value);
    }
}



不支持的关键字:"unicode".

说明:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息.

异常详细信息:System.ArgumentException:不支持关键字:"unicode".



keyword not supported: ''unicode''.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Keyword not supported: ''unicode''.

Source Error: 

Line 36:         if (!IsPostBack)
Line 37:         {
Line 38:             GridView1.DataBind();
Line 39:         }
Line 40: 

Source File: d:\Rahul_doc_soft\product\page\gridview.aspx.cs    Line: 38 



输入值并按提交按钮时出现错误,我在上面提到的错误得到了
请帮助我
给我适当的解决方案



i am getting error when i put the value and press submit button then i am getting error which i mension above
plese help me
give me proper solution

推荐答案



使用以下方法绑定网格
Hi,

use following way to bind grid
SqlDataSource DataSourecX = new SqlDataSource(); 
        DataSourecX.ConnectionString = ConfigurationManager.ConnectionStrings["oracle"].ConnectionString;;

        DataSourecX.SelectCommand = "select customer_name,product,quantity,price,date_info from db_list"; 
        DataSourecX.Select(DataSourceSelectArguments.Empty); 


        GridView1.DataSource = DataSourecX; 
        GridView1.DataBind(); 



希望对您有帮助
祝你好运



Hope it will Help u
Best Luck


这篇关于网格视图问题在这里的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆