selvi subramanian

selvi subramanian

  • NA
  • 799
  • 571.6k

error in update query

Jul 3 2014 12:54 AM
string nm = ((Label)GridView1.Rows[e.RowIndex].FindControl("lblname")).Text;
string Bo = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txnbno")).Text;
//string BNo = Convert.ToInt32(Bo)
string bdate = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtbildate")).Text;
string adre = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtadrsse")).Text;
string phn = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtphnebin")).Text;
string emil = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtemidl")).Text;
string supfr = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtsupfor")).Text;
string bbd = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtbnd")).Text;
SqlConnection con = new SqlConnection(strConnString);
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "update suplerrate set BillNo=@BillNo," + "BillDate=@BillDate," + "Address=@Address, " + " Phone=@Phone ," + " EmailId=@EmailId," + "Supplierfor=@Supplierfor," + "Brand=@Brand where Name=@Name;" +
"select Name, BillNo,BillDate, Address,Phone,EmailId,Supplierfor,Brand from suplerrate";
// "select Name, BillNo,BillDate, Address,Phone,EmailId,Supplierfor,Brand,Billingrate,vat,discount,total,percentage,amount from suplerrate";
cmd.Parameters.Add("@Name", SqlDbType.VarChar).Value = nm;
cmd.Parameters.Add("@BillNo", SqlDbType.Int).Value = BNo;
cmd.Parameters.Add("@BillDate", SqlDbType.VarChar).Value = bdate;
cmd.Parameters.Add("@Address", SqlDbType.VarChar).Value = adre;
cmd.Parameters.Add("@Phone", SqlDbType.BigInt).Value = phn;
cmd.Parameters.Add("@EmailId", SqlDbType.VarChar).Value = emil;
cmd.Parameters.Add("@Supplierfor", SqlDbType.VarChar).Value = supfr;
cmd.Parameters.Add("@Brand", SqlDbType.VarChar).Value = bbd;
GridView1.EditIndex = -1;
GridView1.DataSource = GetData(cmd);
GridView1.DataBind();
 
 
 
 my source code is
 
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"
Font-Names = "Arial" Font-Size = "11pt" BackColor="White"
AlternatingRowStyle-BackColor = "#C2D69B" HeaderStyle-BackColor = "pink"
ShowFooter="true" onrowediting="EditCustomer"
onrowcancelingedit="CancelEdit"
onrowupdating="UpdateCustomer">
<Columns>
<asp:TemplateField HeaderText="Name" ItemStyle-Width = "5px">
<ItemTemplate>
<asp:Label ID="lblname" runat="server" Text="<%#bind('Name') %>"></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txbna" runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="BillNo">
<ItemTemplate>
<asp:Label ID="lblbillno" runat="server" Text="<%# bind('BillNo') %>"></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txnbno" runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="BillDate">
<ItemTemplate>
<asp:Label ID="lbldatebil" runat="server" Text="<%#bind('BillDate' )%>"></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtbildate" runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Address">
<ItemTemplate>
<asp:Label ID="lblladrss" runat="server" Text="<%#bind('Address') %>"></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtadrsse" runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Phone">
<ItemTemplate>
<asp:Label ID="lblbinpho" runat="server" Text="<%#bind('Phone') %>"></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtphnebin" runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="EmailId">
<ItemTemplate>
<asp:Label ID="lblemiid" runat="server" Text="<%#bind('EmailId') %>"></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtemidl" runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Supplierfor">
<ItemTemplate>
<asp:Label ID="lblsuplerfor" runat="server" Text="<%#bind('Supplierfor') %>"></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtsupfor" runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Brand">
<ItemTemplate>
<asp:Label ID="lblbrdn" runat="server" Text="<%#bind('Brand') %>"></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtbnd" runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<%-- <asp:TemplateField HeaderText="Billingrate">
<ItemTemplate>
<asp:Label ID="lbbigent" runat="server" Text="<%#bind('Billingrate') %>"></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtbingnnt" runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="vat">
<ItemTemplate>
<asp:Label ID="lbvvat" runat="server" Text="<%#bind('vat') %>"></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txvaatb" runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="discount">
<ItemTemplate>
<asp:Label ID="lbdisun" runat="server" Text="<%#bind('discount') %>"></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtdiscnt" runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="total">
<ItemTemplate>
<asp:Label ID="lbtolot" runat="server" Text="<%#bind('total') %>"></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txttoool" runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="percentage">
<ItemTemplate>
<asp:Label ID="lblpercng" runat="server" Text="<%#bind('percentage') %>"></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtpecntge" runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="amount">
<ItemTemplate>
<asp:Label ID="lbamt" runat="server" Text="<%#bind('amount') %>"></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtamnut" runat="server"></asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
--%> <asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkRemove" runat="server" CommandArgument = '<%# Eval("Name")%>' OnClientClick = "return confirm('Do you want to delete?')"
Text = "Delete" OnClick = "DeleteCustomer"> </asp:LinkButton>
</ItemTemplate>
<FooterTemplate>
<asp:Button ID="btnAdd" runat="server" Text="Add" OnClick = "AddNewCustomer" />
</FooterTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="True" />
</Columns><AlternatingRowStyle BackColor="#C2D69B" />
</asp:GridView>
 
 
 
my error is 
 
 
 

Server Error in '/bramandam site' Application.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0103: The name 'BNo' does not exist in the current context

Source Error:

 
Line 421:        //  "select  Name, BillNo,BillDate, Address,Phone,EmailId,Supplierfor,Brand,Billingrate,vat,discount,total,percentage,amount from suplerrate"; Line 422:        cmd.Parameters.Add("@Name", SqlDbType.VarChar).Value = nm; Line 423:        cmd.Parameters.Add("@BillNo", SqlDbType.Int).Value = BNo; Line 424:        cmd.Parameters.Add("@BillDate", SqlDbType.VarChar).Value = bdate; Line 425:        cmd.Parameters.Add("@Address", SqlDbType.VarChar).Value = adre;

Source File: d:\bramandam site\stockentry.aspx.cs Line: 423


Show Detailed Compiler Output:

Show Complete Compilation Source:



Version Information: Microsoft .NET Framework Version:2.0.50727.4984; ASP.NET Version:2.0.50727.4971
 
 
 
 
 
 
 
 
 
 

Answers (1)