p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Basics (http://p2p.wrox.com/forumdisplay.php?f=136)
-   -   How to add a new column into gridview? (http://p2p.wrox.com/showthread.php?t=62024)

Bryan Stanley September 12th, 2007 10:49 PM

How to add a new column into gridview?
 
Hi everybody...
i'm the new guy here and also a new user for vb.net source code...
i want to ask about how to add a new and empty column to a gridview which can type the heading in a textbox and click a button to add the column in the runtime by using the vb.net source code?
Can anybody help me?

so far i have this code to view my data in the gridview:



        Dim ds As DataSet = New DataSet()
        Dim conn As OleDbConnection = New OleDbConnection

        Dim cmd As OleDbCommand = New OleDbCommand

        Dim DataAdapter As OleDbDataAdapter = New OleDbDataAdapter()

        conn.ConnectionString = ("Provider=microsoft.jet.oledb.4.0;data source = " & Server.MapPath("db1.mdb"))

        cmd.Connection = conn

        cmd.CommandText = "SELECT * FROM Stock"

        DataAdapter.SelectCommand = cmd
        DataAdapter.Fill(ds, "Stock")
        gv1.DataSource = ds
        gv1.DataBind()

        conn.Open()

        DataAdapter.Fill(ds, "Stock")


        gv1.DataSource = ds



All times are GMT -4. The time now is 08:04 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.