The object must implement IConvertible
-
Hi!! I have this error message: "The object must implement IConvertible." in this line myAdapter.Fill(ds, "Table1"); my code is:
private void BindData() { try { SqlConnection myConnection = new SqlConnection(ConnectionString); SqlCommand myCommand = new SqlCommand("SP_S1", myConnection); myCommand.Parameters.Add("@ch1", SqlDbType.VarChar, 30).Value = DropDownList1.SelectedItem; myCommand.CommandType = CommandType.StoredProcedure; SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand); DataSet ds = new DataSet(); myAdapter.Fill(ds, "Table1"); myConnection.Open(); myCommand.ExecuteNonQuery(); GridView1.DataSource = ds; GridView1.DataBind(); myConnection.Close(); } catch (Exception) { } }
someone could help me? Thanks. -
Hi!! I have this error message: "The object must implement IConvertible." in this line myAdapter.Fill(ds, "Table1"); my code is:
private void BindData() { try { SqlConnection myConnection = new SqlConnection(ConnectionString); SqlCommand myCommand = new SqlCommand("SP_S1", myConnection); myCommand.Parameters.Add("@ch1", SqlDbType.VarChar, 30).Value = DropDownList1.SelectedItem; myCommand.CommandType = CommandType.StoredProcedure; SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand); DataSet ds = new DataSet(); myAdapter.Fill(ds, "Table1"); myConnection.Open(); myCommand.ExecuteNonQuery(); GridView1.DataSource = ds; GridView1.DataBind(); myConnection.Close(); } catch (Exception) { } }
someone could help me? Thanks.try to make this changes
myCommand.Parameters.Add("@ch1", SqlDbType.VarChar, 30).Value = DropDownList1.SelectedValue;
Also try to search on google [^]like first.
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.
-
try to make this changes
myCommand.Parameters.Add("@ch1", SqlDbType.VarChar, 30).Value = DropDownList1.SelectedValue;
Also try to search on google [^]like first.
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.