selvi subramanian

selvi subramanian

  • NA
  • 799
  • 570.8k

eror in this query

May 15 2014 6:26 AM
my design
<table class="style1" align="center" style="border: thin outset #1d599e; width: 34%; margin-left: 0px;">
<tr align="center">
<td class="style2" colspan="2">
<asp:Label ID="Label1" runat="server" Text="Registration Form"
style="font-weight: 700; font-style: italic; font-family: Arial, Helvetica, sans-serif"></asp:Label>
</td>
</tr>
<tr >
<td class="style5">
<asp:Label ID="Label2" runat="server" Text="Name" style="text-align: left"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server" ontextchanged="TextBox1_TextChanged"
AutoPostBack="True"></asp:TextBox>
</td>
</tr>
<tr >
<td>
<asp:Label ID="Label10" runat="server" Text="ID"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
</tr>
<tr >
<td class="style5">
<asp:Label ID="Label3" runat="server" Text="Gender" style="text-align: left"></asp:Label>
</td>
<td>
<asp:RadioButton ID="Male" runat="server" Text="Male" GroupName="s" />
<asp:RadioButton ID="Female" runat="server" Text="Female" GroupName="s" />
<asp:Label ID="Label9" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr >
<td class="style3">
<asp:Label ID="Label4" runat="server" Text="Address"></asp:Label>
</td>
<td class="style4">
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</td>
</tr>
<tr >
<td class="style5">
<asp:Label ID="Label5" runat="server" Text="Mobile"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox4" runat="server" MaxLength="10" onkeypress="return AllowNumbers(event);"></asp:TextBox>
</td>
</tr>
<tr >
<td class="style5">
<asp:Label ID="Label6" runat="server" Text="Date of joining"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox5" runat="server" ReadOnly="True"></asp:TextBox>
</td>
</tr>
<tr >
<td class="style2">
<asp:Label ID="Label7" runat="server" Text="Section"></asp:Label>
</td>
<td>
<asp:DropDownList ID="DropDownList1" runat="server" style="margin-left: 0px" Width="153px"> </asp:DropDownList>
</td>
</tr> <tr align="center">
<td class="style6" align="center" colspan="2">
<asp:ImageButton ID="ImageButton1" runat="server" Height="34px" ImageUrl="~/Images/side_button_register_pink.gif" Width="101px" onclick="ImageButton1_Click" OnClientClick="return error()" />
<asp:ImageButton ID="ImageButton2" runat="server" Height="34px" ImageUrl="~/Images/clearr.jpg" Width="101px" onclick="ImageButton2_Click" />
<asp:Label ID="Label8" runat="server" Text=""></asp:Label>
</td>
</tr>
</table>
 
 
 
my code is 
 
 
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
con = new SqlConnection("Data Source=SELVI-PC\\SQLEXPRESS;Initial Catalog=bramandam;Persist Security Info=True;Integrated Security=True");
string sq = "select min(numbr) from noo where numbr=numbr";
ds = mvl.GETDS(sq);
foreach (DataRow dr in ds.Tables[0].Rows)
{
TextBox2.Text = dr["numbr"].ToString();
}
}
 
my error is
 

Server Error in '/Birmandam' Application.

Column 'numbr' does not belong to table Table.

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: Column 'numbr' does not belong to table Table.

Source Error:

Line 103:      foreach (DataRow dr in ds.Tables[0].Rows) Line 104:      { Line 105:          TextBox2.Text = dr["numbr"].ToString(); Line 106:      } Line 107:   }
 

Answers (3)