data grid

B

bushi

hi every one!
i'm trying to display my data using DataGrid,there is no Data
Grid control available in asp.net(vs 2005).i'm trying to do it
programmatically,but it shows nothing:i have used the following code:

con.Open();
OleDbCommand cmd1 = con.CreateCommand();
OleDbDataAdapter dap = new OleDbDataAdapter("select * from
admin", con);
OleDbCommandBuilder cb = new OleDbCommandBuilder(dap);
DataSet ds = new DataSet();
ds.Fill(dap, 0, 0, "admin");
DataGrid dg=new DataGrid();
dg.DataSource=ds;
con.Close();

plz guid me how to do it,i will wait anxiously
 
B

Bruno Alexandre

"there is no Data Grid control available in asp.net(vs 2005)"

good grace it is not available !!!


you have GridView that is much more powerfull that DataGrid ;-)

http://www.gridviewguy.com has a lot of wonderful articlaes so you can
see what you can accomplish with this beutifull control

Bruno Alexandre
 
M

Mark Rae

i'm trying to display my data using DataGrid,

there is no DataGrid control available in asp.net

The DataGrid control is still there if you absolutely must use it...

<asp:DataGrid ID="MyDataGrid" runat="server" />
 
G

Guest

// con.open(); not required.
OleDbCommand cmd1 = con.CreateCommand("add connection string here");
OleDbDataAdapter dap = new OleDbDataAdapter("select * from admin",
con);
// OleDbCommandBuilder cb = new OleDbCommandBuilder(dap); not required
DataSet ds = new DataSet();
ds.Fill(dap);
// DataGrid dg=new DataGrid(); place the control using page designer
dg.DataSource=ds;

// con.Close(); not required
dg.DataBind(); // add this line

-Praveen
 
G

Guest

OOps! error,
Conection stirng is not rquired on line number 3. Infact you dont need that
line at all!
 
G

Guest

Datagrid is there - just add it to the Toolbox. As mentioned, DataGridView is
better and does all the same and more.
Peter
 
B

bushi

thanx Mark...
it helps me.now tell me how i can update or delete the
records in it???
plzzzzzzz rply as soon as possible........
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top