Monday, August 16, 2010

What is the collection base in the Vb.Net?? and how can i use it to bind an objects into a datagrid?

thank you very much i need a very imediat anser please :PWhat is the collection base in the Vb.Net?? and how can i use it to bind an objects into a datagrid?
Use


Imports System.Data.SqlClient


and


Imports System.Data


collections if you use sql server.





To bind to the data grid





'2. Create the command object, passing in the SQL string


Const strSQL As String = ';select * from pcsystems';


Dim myCommand As New SqlCommand(strSQL, myConnection)





'Set the datagrid's datasource to the datareader and databind


myConnection.Open()


Grid1.DataSource = myCommand.ExecuteReader(CommandBehavior.鈥?br>

Grid1.DataBind()








call databind function on form load..... Thats allWhat is the collection base in the Vb.Net?? and how can i use it to bind an objects into a datagrid?
You can use 'SetDataBinding' procedure of the datagrid.


eg:


with datagrid1


.TableStyles.Add(dgtsMyTable)


.SetDataBinding(dtMyTable, ';';)


end with


where


dtMyTable = The table to be bound with the datagrid.


dgtsMyTable = The datagridTableStyle for the table MyTable
  • love myspace
  • myspace girl
  • No comments:

    Post a Comment