View Single Post
  #1 (permalink)  
Old September 12th, 2007, 10:49 PM
Bryan Stanley Bryan Stanley is offline
Registered User
 
Join Date: Aug 2007
Location: , , Malaysia.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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

Reply With Quote