请问做一个GridView的嵌套,为什么出错提示ORA-01036,变量名或数值无效?
执行起来就提示
OracleException (0x80131938): ORA-01036,变量名或数值无效。
请高手帮忙看一下,不胜感激。
本程序的功能是在执行grv1的时候,实现grv1的数据distinct,然后以一个id对应多个在grv2中ID相同的记录的形式显示.
id | name
-------------------------
| Micheal
------------------
001 | Linc
------------------
| Bagwell
--------------------------
002 | Fenando
--------------------------
......
以下是程序代码:
protected void Page_Load(object sender, EventArgs e)
{
.......
String sqlcmd = " SELECT DISTINCT id FROM emp ";
using (OracleConnection cn = COMUtility.GetConnection())
{
using (OracleDataAdapter da = new OracleDataAdapter(sqlcmd, cn))
{
DataSet ds = new DataSet();
da.Fill(ds, "emp ");
DataTable dt = new DataTable();
dt = ds.Tables[ "emp "];
grv1.DataSource = ds.Tables[ "emp "];
grv1.DataBind();
}
}
.......
}
protected void grv1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
System.Data.DataRowView drv = (DataRowView)e.Row.DataItem;
String id drv.Row.ItemArray[0].ToString();
SqlDataSource sds = e.Row.FindControl( "SqlDataSource1 ") as SqlDataSource;
sds.SelectParameters[ "id "].DefaultValue = id;
}
}
aspx代码:
<asp:GridView ID= "grv1 " runat= "server " AutoGenerateColumns= "False " DataKeyNames= "id " AllowPaging= "True " AllowSorting= "True " PageSize= "10 " OnRowDataBound= "grv1_RowDataBound " >
<Columns>
<asp:BoundField DataField= "id " HeaderText= "id " />
<asp:TemplateFie