DataGrid
-
I want to use database in connected mode with DataReader.After I use ExecuteReader() I waana fill DataGrid with it but I can't add row to DataGrid dynamicly or show the table in DataGrid in Connected mode.
OleDbCommand command = new OleDbCommand ( "select * from Tennis", this.myoleDbConnection );
myoleDbConnection.Open ();
OleDbDataReader reader = command.ExecuteReader ( );
while ( reader.Read () )
{
//How can I fill DataGrid?????
}
reader.Close ();
myoleDbConnection.Close ();Mazy "The path you tread is narrow and the drop is shear and very high, The ravens all are watching from a vantage point near by, Apprehension creeping like a choo-train uo your spine, Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
-
I want to use database in connected mode with DataReader.After I use ExecuteReader() I waana fill DataGrid with it but I can't add row to DataGrid dynamicly or show the table in DataGrid in Connected mode.
OleDbCommand command = new OleDbCommand ( "select * from Tennis", this.myoleDbConnection );
myoleDbConnection.Open ();
OleDbDataReader reader = command.ExecuteReader ( );
while ( reader.Read () )
{
//How can I fill DataGrid?????
}
reader.Close ();
myoleDbConnection.Close ();Mazy "The path you tread is narrow and the drop is shear and very high, The ravens all are watching from a vantage point near by, Apprehension creeping like a choo-train uo your spine, Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
I don't think you can fill the datagrid directly, you have to use a datatable at the very least. James Simplicity Rules!
-
I don't think you can fill the datagrid directly, you have to use a datatable at the very least. James Simplicity Rules!
Yes,thats the thing I find out today,So I think when I want use DataReader it is not good idea to use DataGrid and ListView is better option for it.Beacaue for DataGrid I have to use DataSet or DataTable so I have to do one extra operation.Whats your opinion about it? Thanks :) Mazy "The path you tread is narrow and the drop is shear and very high, The ravens all are watching from a vantage point near by, Apprehension creeping like a choo-train uo your spine, Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
-
Yes,thats the thing I find out today,So I think when I want use DataReader it is not good idea to use DataGrid and ListView is better option for it.Beacaue for DataGrid I have to use DataSet or DataTable so I have to do one extra operation.Whats your opinion about it? Thanks :) Mazy "The path you tread is narrow and the drop is shear and very high, The ravens all are watching from a vantage point near by, Apprehension creeping like a choo-train uo your spine, Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
-
[my 2 cents] Using a listview is a far better option. Short of prototyping, I don't see a place for large scale databinding in applications. Cheers, Simon "I get paid for my brain and my thinking in several obscure worlds", Olli, The Lounge
[my 2 cents too] I understand this using the old databinding control (see VB 6 controls), but with the new ADO.NET model I think things have changed, the combination of Connection, DataAdapter, DataSet and DataGrid should work a lot better. Anyway, I haven't done any testing yet. Andres Manggini. Buenos Aires - Argentina.
-
[my 2 cents too] I understand this using the old databinding control (see VB 6 controls), but with the new ADO.NET model I think things have changed, the combination of Connection, DataAdapter, DataSet and DataGrid should work a lot better. Anyway, I haven't done any testing yet. Andres Manggini. Buenos Aires - Argentina.
Correct, the VB6 controls sucked because they always kept a connect to the database open, so you could count on there being x number of connections at any one time. With the .NET model you open a connection, get the data, then close the connection; everything is operated on in a disconnected state. Once you're done editing you can ignore the changes or open another connection and make the changes. James Simplicity Rules!
-
I want to use database in connected mode with DataReader.After I use ExecuteReader() I waana fill DataGrid with it but I can't add row to DataGrid dynamicly or show the table in DataGrid in Connected mode.
OleDbCommand command = new OleDbCommand ( "select * from Tennis", this.myoleDbConnection );
myoleDbConnection.Open ();
OleDbDataReader reader = command.ExecuteReader ( );
while ( reader.Read () )
{
//How can I fill DataGrid?????
}
reader.Close ();
myoleDbConnection.Close ();Mazy "The path you tread is narrow and the drop is shear and very high, The ravens all are watching from a vantage point near by, Apprehension creeping like a choo-train uo your spine, Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
You need to use a datactrl, then assign the datagrid to datacontrol and in your code asign the dataset to datactrl Best Regards Carlos Antollini. Sonork ID 100.10529 cantollini
-
You need to use a datactrl, then assign the datagrid to datacontrol and in your code asign the dataset to datactrl Best Regards Carlos Antollini. Sonork ID 100.10529 cantollini
DataSet work in disconnected mode,I wanna use connected mode.:) Mazy "The path you tread is narrow and the drop is shear and very high, The ravens all are watching from a vantage point near by, Apprehension creeping like a choo-train uo your spine, Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd