DataBinding:'System.Data.DataRowView'不包含名为'Type'的属性。 [英] DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'Type'.

查看:69
本文介绍了DataBinding:'System.Data.DataRowView'不包含名为'Type'的属性。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在sql server中更改数据库名称时发生此错误

但运行的方法我确定我在connectionString中也更改了数据库名称

如何解决这个问题...... Plz



--------------------------- ---------------------------

protected void BindEmployeeDetails2()

{

con.Open();

int userid = int.Parse(Request.QueryString [UserId]);

SqlCommand cmd = new SqlCommand(从SU_Seeker_Qualifications选择*,其中UserId =+ userid,con);

SqlDataAdapter da = new SqlDataAdapter(cmd);

DataSet ds = new DataSet();

da.Fill(ds);

con.Close();

if(ds.Tables [0] .Rows.Count> ; 0)

{

gvDetails2.DataSource = ds;

gvDetails2.DataBind();

} < br $> b $ b其他

{

ds.Tables [0] .Rows.Add(ds.Tables [0] .NewRow());

gvDetails2.DataSource = ds;

gvDetails2.DataBind();

int columncount = gvDetails2.Rows [0] .Cells.Count;

gvDetails2.Rows [0] .Cells.Clear ();

gvDetails2.Rows [0] .Cells.Add(new TableCell());

gvDetails2.Rows [0] .Cells [0] .ColumnSpan = columncount;

gvDetails2.Rows [0] .Cells [0] .Text =没有找到记录;

}



-----------------------------------------



this error occurred when i change the database name in sql server
but the the method running and im sure i changed the database name also in the connectionString
how to solve this problem ... Plz

------------------------------------------------------
protected void BindEmployeeDetails2()
{
con.Open();
int userid = int.Parse(Request.QueryString["UserId"]);
SqlCommand cmd = new SqlCommand("Select * from SU_Seeker_Qualifications where UserId=" + userid , con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
con.Close();
if (ds.Tables[0].Rows.Count > 0)
{
gvDetails2.DataSource = ds;
gvDetails2.DataBind();
}
else
{
ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());
gvDetails2.DataSource = ds;
gvDetails2.DataBind();
int columncount = gvDetails2.Rows[0].Cells.Count;
gvDetails2.Rows[0].Cells.Clear();
gvDetails2.Rows[0].Cells.Add(new TableCell());
gvDetails2.Rows[0].Cells[0].ColumnSpan = columncount;
gvDetails2.Rows[0].Cells[0].Text = "No Records Found";
}

-----------------------------------------

<asp:GridView ID="gvDetails2" DataKeyNames="UserId,Id" runat="server"

        AutoGenerateColumns="False" CssClass="Gridview" HeaderStyle-BackColor="#0C8063"

ShowFooter="True" HeaderStyle-Font-Bold="true" HeaderStyle-ForeColor="White"

        onrowcancelingedit="gvDetails2_RowCancelingEdit"

        onrowdeleting="gvDetails2_RowDeleting" onrowediting="gvDetails2_RowEditing"

        onrowupdating="gvDetails2_RowUpdating"

        onrowcommand="gvDetails2_RowCommand">

<Columns>
<asp:TemplateField>
<EditItemTemplate>
<asp:ImageButton ID="imgbtnUpdate" CommandName="Update" runat="server" ImageUrl="~/Images/update.jpg" ToolTip="Update" Height="20px" Width="20px" />
<asp:ImageButton ID="imgbtnCancel" runat="server" CommandName="Cancel" ImageUrl="~/Images/Cancel.jpg" ToolTip="Cancel" Height="20px" Width="20px" />

</EditItemTemplate>
<ItemTemplate>
<asp:ImageButton ID="imgbtnEdit" CommandName="Edit" runat="server" ImageUrl="~/Images/Edit.jpg" ToolTip="Edit" Height="20px" Width="20px" />
<asp:ImageButton ID="imgbtnDelete" CommandName="Delete" Text="Edit" runat="server" ImageUrl="~/Images/delete.jpg" ToolTip="Delete" Height="20px" Width="20px" />
</ItemTemplate>
<FooterTemplate>
<asp:ImageButton ID="imgbtnAdd" runat="server" ImageUrl="~/Images/AddNewitem.jpg" CommandName="AddNew" Width="30px" Height="30px" ToolTip="Add new User" ValidationGroup="validaiton" />

</FooterTemplate>
 </asp:TemplateField>
<asp:TemplateField HeaderText=" النوع">
<EditItemTemplate>
    <asp:TextBox ID="txtType" runat="server" Text='<%#Eval("Type") %>'/>

</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblType" runat="server" Text='<%#Eval("Type") %>'/>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtftrType" runat="server"/>
<asp:RequiredFieldValidator ID="rfvType" runat="server" ControlToValidate="txtftrType" Text="*" ValidationGroup="validaiton"/>
</FooterTemplate>
</asp:TemplateField>
 <asp:TemplateField HeaderText="تاريخ الالتحاق">
 <EditItemTemplate>
 <asp:TextBox ID="txtJoin_Date" runat="server" Text='<%#Eval("Join_Date") %>'/>
 </EditItemTemplate>
 <ItemTemplate>
 <asp:Label ID="lblJoin_Date" runat="server" Text='<%#Eval("Join_Date") %>'/>
 </ItemTemplate>
 <FooterTemplate>
 <asp:TextBox ID="txtftrJoin_Date" runat="server"/>
 <asp:RequiredFieldValidator ID="rfvJoin_Date" runat="server" ControlToValidate="txtftrJoin_Date" Text="*" ValidationGroup="validaiton"/>
 </FooterTemplate>
 </asp:TemplateField>
 <asp:TemplateField HeaderText="تاريخ التخرج">
 <EditItemTemplate>
 <asp:TextBox ID="txtGraduated_Date" runat="server" Text='<%#Eval("Graduated_Date") %>'/>

 </EditItemTemplate>
 <ItemTemplate>
 <asp:Label ID="lblGraduated_Date" runat="server" Text='<%#Eval("Graduated_Date") %>'/>
 </ItemTemplate>
 <FooterTemplate>
 <asp:TextBox ID="txtftrGraduated_Date" runat="server"/>
  <asp:RequiredFieldValidator ID="rfvGraduated_Date" runat="server" ControlToValidate="txtftrGraduated_Date" Text="*" ValidationGroup="validaiton"/>
 </FooterTemplate>
 </asp:TemplateField>
    <asp:TemplateField HeaderText="الجامعــه">
 <EditItemTemplate>
 <asp:TextBox ID="txtUniverisity" runat="server" Text='<%#Eval("Univerisity") %>'/>

 </EditItemTemplate>
 <ItemTemplate>
 <asp:Label ID="lblUniverisity" runat="server" Text='<%#Eval("Univerisity") %>'/>
 </ItemTemplate>
 <FooterTemplate>
 <asp:TextBox ID="txtftrUniverisity" runat="server"/>
  <asp:RequiredFieldValidator ID="rfvUniverisity" runat="server" ControlToValidate="txtftrUniverisity" Text="*" ValidationGroup="validaiton"/>
 </FooterTemplate>
 </asp:TemplateField>
    <asp:TemplateField HeaderText="الكليـــه">
        <EditItemTemplate>
 <asp:TextBox ID="txtFaculty" runat="server" Text='<%#Eval("Faculty") %>'/>

 </EditItemTemplate>
 <ItemTemplate>
 <asp:Label ID="lblFaculty" runat="server" Text='<%#Eval("Faculty") %>'/>
 </ItemTemplate>
 <FooterTemplate>
 <asp:TextBox ID="txtftrFaculty" runat="server"/>
  <asp:RequiredFieldValidator ID="rfvFaculty" runat="server" ControlToValidate="txtftrFaculty" Text="*" ValidationGroup="validaiton"/>
 </FooterTemplate>
    </asp:TemplateField>
     <asp:TemplateField HeaderText="التخصــص">
        <EditItemTemplate>
 <asp:TextBox ID="txtMajor" runat="server" Text='<%#Eval("Major") %>'/>
 </EditItemTemplate>
 <ItemTemplate>
 <asp:Label ID="lblMajor" runat="server" Text='<%#Eval("Major") %>'/>
 </ItemTemplate>
 <FooterTemplate>
 <asp:TextBox ID="txtftrMajor" runat="server"/>
  <asp:RequiredFieldValidator ID="rfvMajor" runat="server" ControlToValidate="txtftrMajor" Text="*" ValidationGroup="validaiton"/>
 </FooterTemplate>
    </asp:TemplateField>

     <asp:TemplateField HeaderText="المعدل التراكمى">
        <EditItemTemplate>
 <asp:TextBox ID="txtGrade" runat="server" Text='<%#Eval("Grade") %>'/>
 </EditItemTemplate>
 <ItemTemplate>
 <asp:Label ID="lblGrade" runat="server" Text='<%#Eval("Grade") %>'/>
 </ItemTemplate>
 <FooterTemplate>
 <asp:TextBox ID="txtftrGrade" runat="server"/>
  <asp:RequiredFieldValidator ID="rfvGrade" runat="server" ControlToValidate="txtftrGrade" Text="*" ValidationGroup="validaiton"/>
 </FooterTemplate>
    </asp:TemplateField>
 </Columns>

<HeaderStyle BackColor="#0C8063" Font-Bold="True" ForeColor="White"></HeaderStyle>
</asp:GridView>





推荐答案

Please ensure the select \"Select * from SU_Seeker_Qualificationsstate .... \" contains the column name \"Type\"
Please ensure the select "Select * from SU_Seeker_Qualificationsstate .... " contains the column name "Type"


这篇关于DataBinding:'System.Data.DataRowView'不包含名为'Type'的属性。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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