How to Create a new column in excel with Vb.net and ado.net

Discussion in 'ASP .Net' started by Venkateswara Kumar Kasaram via .NET 247, Mar 21, 2005.

  1. Hi,
    I am working with excel as a database.first i am getting thedatafrom excel and creating dataset and later i am working withdataset,where i am creating new column in to thedataset.Finnalyi want to update the excel sheet with the datasetvalues.But i am not able to create a new columns which arecreated in dataset in to excel.

    Simply:

    i need to create a new column byusing VB.net and ADO.net

    Kindly please help me on this
    Thanks in advance
    --------------------------------
    From: Venkateswara Kumar Kasaram

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>y3B5m4ZPZk+LNyQPQpazmw==</Id>
    Venkateswara Kumar Kasaram via .NET 247, Mar 21, 2005
    #1
    1. Advertising

  2. Venkateswara Kumar Kasaram via .NET 247

    julia Guest

    Dear Venkateswara,

    The ADO.NET components provide two mode of database manipulation. One is
    use Command object to execute sql statement. Another is use DataSet to
    mantain a local memory database and can be update to server as a whole
    DataBase entity such as a DataTable. However, such update mode is "records
    based". In other words, we can add or remove records from a certain
    DataTable through this way( add some new rows in the certain DataTable).
    But we are not able to modify the Database or a certain Table's
    structure(such as add or delete a column of a DataTable and update it use
    DataAdaptor.Update method). So as for your situation, if you add some
    DataColumns in a certain DataTable in the local DataSet and update it to
    server, it won't be able to modify the actual table's structure in the DBMS.

    However, if you do want to use ADO.NET component to modify the data
    table's structure on the db server. You may need to use the Command object
    to execute sql statement . The following example is for SQL Server:
    ----------------------------------------
    sqlConnection1.Open();

    // add a column into a table
    cmdText = "ALTER TABLE mytable ADD description char(200) ";
    SqlCommand addColumnCmd = new SqlCommand ( cmdText, sqlConnection1 );
    addColumnCmd.ExecuteNonQuery();

    //delete a column from a table
    cmdText = "ALTER TABLE mytable DROP COLUMN description"
    SqlCommand dropColumnCmd = new SqlCommand ( cmdText, sqlConnection1 );
    dropColumnCmd.ExecuteNonQuery();

    sqlConnection1.Close();
    ------------------------------------------------------

    Thus, we can actually modify the table's structure in the database server.

    HTH

    Mona

    "Venkateswara Kumar Kasaram via .NET 247" <> wrote in
    message news:...
    Hi,
    I am working with excel as a database.first i am getting the datafrom
    excel and creating dataset and later i am working with dataset,where i am
    creating new column in to the dataset.Finnalyi want to update the excel
    sheet with the dataset values.But i am not able to create a new columns
    which are created in dataset in to excel.

    Simply:

    i need to create a new column byusing VB.net and ADO.net

    Kindly please help me on this
    Thanks in advance
    --------------------------------
    From: Venkateswara Kumar Kasaram

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>y3B5m4ZPZk+LNyQPQpazmw==</Id>
    julia, Mar 22, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. nita
    Replies:
    1
    Views:
    866
    Saravana
    Nov 20, 2004
  2. ronaldlee

    Transfer ADO Code to ADO.NET

    ronaldlee, Dec 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    453
    Kevin Spencer
    Dec 17, 2004
  3. Replies:
    0
    Views:
    1,309
  4. Jona
    Replies:
    2
    Views:
    450
    Victor Bazarov
    Jul 6, 2007
  5. Navin
    Replies:
    1
    Views:
    685
    Ken Schaefer
    Sep 9, 2003
Loading...

Share This Page