This is my column in db
mobno bigint
9491992426 9491992426 9491992426 9491992426 9491992426 9491992426
This is my SP
create procedure sp_SearchBy @mobno bigint as begin select * from form where mobno like '%' + @mobno + '%' end
i want to search with mobile number in grid view . when i searched with name i got the result but when i search with mobile no it is showing input string was in invlid format
i have taken bigint for mobno in db i want to search with mobile number pls help me
This is my webform.aspx.cs
public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (IsPostBack == false) { DisplayInfo(); } if (!this.IsPostBack) { this.BindGrid(); } } void DisplayInfo() { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString()); string query = "select * from form"; SqlCommand cmd = new SqlCommand(query, con); SqlDataAdapter da = new SqlDataAdapter(cmd); con.Open(); DataSet ds = new DataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); con.Close(); } protected void Button1_Click(object sender, EventArgs e) { this.BindGrid(); } private void BindGrid() (This Is for Searching ) { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString()); SqlCommand cmd = new SqlCommand("sp_SearchByme", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@mobno",Convert.ToInt32(TextBox7.Text)); //(I got the error here conversion problem) //(Input string was not in a correct format) DataTable dt = new DataTable(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dt); GridView1.DataSource = dt; GridView1.DataBind(); } } protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridView1.PageIndex = e.NewPageIndex; this.BindGrid(); } }