none
ListObject and custom columns. RRS feed

  • Question

  • Hi,

    I have a listObject in my excel sheet (vsto), i populate that list with some data from a database, i also have a custom column that i have added in design mode which contains a formula. The problem is that each time i bind data to the list object it rests all the columns and loads those from the database, so my custom column is deleted. Does anyone know how to solve this issue?

    I using visual studio 2010 and running office 2007,

                DataSet ds = new DataSet();
                String connectionString = "Data Source=*******';Initial Catalog=Database;Integrated Security=True";

                String sql = "SELECT DISTINCT NAME ,PRICE FROM TABLE1";

     
                SqlConnection sqlConn = new SqlConnection(connectionString);

                sqlConn.Open();
                Application.StatusBar = "Sql Query";
                SqlCommand cmd = new SqlCommand(sql, sqlConn);
                SqlDataAdapter sqlAdapter = new SqlDataAdapter(cmd);
                //QuickRepoList.DataSource = sqlAdapter;
                Application.StatusBar = "Filling Dataset";

                sqlAdapter.Fill(ds, "Table1");
                QuickRepoList.SetDataBinding(ds, "Table1");

    Wednesday, September 12, 2012 12:55 PM

Answers

  • Hi RepoMannn,

    Thanks for posting in the MSDN Forum.

    I think you are able to add the customized column which will content formula string in your dataset's table then  binding the dataset to your listobject.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us


    Thursday, September 13, 2012 6:46 AM
    Moderator
  • Hi
    first thanks for you help Tom_Xu MSFT but that sounds a bit strange to me.. so i need to insert my excel formula into the database "=A1+B2" to be able to get it in to my objectlist, (in that case it wount be a custom column will it :) ? If that is the case why is it even possible to have a custom column in the listobject? But if that is the only way i will have to do it that way..

    Thursday, September 13, 2012 8:47 AM

All replies

  • Hi RepoMannn,

    Thanks for posting in the MSDN Forum.

    I think you are able to add the customized column which will content formula string in your dataset's table then  binding the dataset to your listobject.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us


    Thursday, September 13, 2012 6:46 AM
    Moderator
  • Hi
    first thanks for you help Tom_Xu MSFT but that sounds a bit strange to me.. so i need to insert my excel formula into the database "=A1+B2" to be able to get it in to my objectlist, (in that case it wount be a custom column will it :) ? If that is the case why is it even possible to have a custom column in the listobject? But if that is the only way i will have to do it that way..

    Thursday, September 13, 2012 8:47 AM
  • Hi RepoMannn,

    I think that is a right way to approach your goal. It's welcome to share your solution here if you are able to find out better work round.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us


    Monday, September 17, 2012 4:41 AM
    Moderator