When i am inputing BL-10002 into textbox, then below error is coming
Conversion failed when converting the varchar value BL-10002 to data type int
<asp:TextBox ID="txtsearcbn" runat="server" AutoPostBack="true" Height="24px" OnTextChanged="txtsearcbn_TextChanged" Width="127px"></asp:TextBox>
C#
String strQuery = "Sp_Retrive_Bale_for_Dispatch";
SqlCommand cmde = new SqlCommand();
cmde.Parameters.AddWithValue("@Bale_ID", txtsearcbn.Text.Trim());
cmde.CommandType = CommandType.StoredProcedure;
cmde.CommandText = strQuery;
cmde.Connection = con;
try
{
con.Open();
SqlDataReader sdr = cmde.ExecuteReader();
while (sdr.Read())
{
lbid.Text = sdr["Bale_ID"].ToString();
ddlitem.SelectedValue = sdr["item_code"].ToString();
txtqty.Text = sdr["Bale_Qty"].ToString();
txtwht.Text = sdr["Bale_Weight"].ToString();
txtdno.Text = sdr["D_ID"].ToString();
}
ALTER Proc [dbo].[Sp_Retrive_Bale_for_Dispatch]
@Bale_ID varchar(15)
as
begin
select Bale_ID,item_code,Bale_Qty,Bale_Weight,D_ID
From tbl_Bale_Prd
where Bale_ID = @Bale_ID and (D_ID IS NULL or D_ID=1)