Display 2 cols n a datagrid.I can only do 1 r all

  • 15 years ago

    Hello
    I was wondering if you could help me.. I can only display one or all columns from a table in my datagrid. My code is below..


     conStr = ConfigurationSettings.AppSettings("mysql.ado.net")
           myConnection = New MySqlConnection(conStr)
           myConnection.Open()
           dataAdapter = New MySqlDataAdapter("select mark from test", myConnection)
           myCommandBuilder = New MySqlCommandBuilder(dataAdapter)
           dataAdapter.Fill(ds, "test")
           myConnection.Close()
           dg.DataSource = New DataView(ds.Tables("test"))


    The code above is for one column 'mark' to be displayed and i can also display all the columns using..

    Code:
      dataAdapter = New MySqlDataAdapter("select * from test", myConnection)


    But i was wondering how I could display two columns from the same table(test) in the same datagrid?????

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“C++: an octopus made by nailing extra legs onto a dog.” - Steve Taylor