Click here to Skip to main content
15,913,669 members
Home / Discussions / C#
   

C#

 
AnswerRe: Conecting to database-C# Pin
Mike Hankey11-Feb-07 7:57
mveMike Hankey11-Feb-07 7:57 
GeneralRe: Conecting to database-C# Pin
mrkeivan11-Feb-07 8:43
mrkeivan11-Feb-07 8:43 
GeneralRe: Conecting to database-C# Pin
Mike Hankey11-Feb-07 9:03
mveMike Hankey11-Feb-07 9:03 
AnswerRe: Conecting to database-C# Pin
Guffa11-Feb-07 8:55
Guffa11-Feb-07 8:55 
GeneralRe: Conecting to database-C# Pin
mrkeivan11-Feb-07 10:18
mrkeivan11-Feb-07 10:18 
AnswerRe: Conecting to database-C# Pin
Guffa11-Feb-07 11:20
Guffa11-Feb-07 11:20 
Questionretrieving data from a DataTable by giving the location Pin
Saira Tanwir11-Feb-07 6:44
Saira Tanwir11-Feb-07 6:44 
AnswerRe: retrieving data from a DataTable by giving the location [modified] Pin
Colin Angus Mackay11-Feb-07 7:05
Colin Angus Mackay11-Feb-07 7:05 
Saira Tanwir wrote:
my DataTable contains the record from a DB table in row and column format.


What do you mean by "row and column format"?


Saira Tanwir wrote:
i want to access the record value on a specific location in the datatable by specifying the row and column number, and then retrieving the value on that particular locaion.


Sorry, I misread what you were saying - I thought you were asking about the table in the database...

In a DataTable you have a collection called Rows. You can access a row by its index
DataRow row = myTable.Rows[rowIndex];

You can then access the column by a column index.
object value = row[columnIndex];


You can't. Databases don't work like that. You can fake it if it is really what you need, but you'll need to add some sort of rownumber column to the table and it will be a real nightmare trying to keep it correctly updated.

A database works on "sets" of data. There is no built in order in a set. You can get the illusion of order by taking into account implementation details of specific databases. For example, in SQL Server you can create a clustered index (usually on the primary key) which will ensure that the data is physically inserted in the order of that index. You can use the ORDER BY clause to sort the rows as they are extracted from the database.

But at the end of it all there is no specific "get me row 42" functionality. SQL Server 2005 has some additional tools to help make faking this easier, but it is still an illusion.




-- modified at 13:11 Sunday 11th February, 2007


QuestionUndo() Method? Pin
Wolf9211-Feb-07 5:43
Wolf9211-Feb-07 5:43 
AnswerRe: Undo() Method? Pin
sharpiesharpie11-Feb-07 6:52
sharpiesharpie11-Feb-07 6:52 
GeneralRe: Undo() Method? Pin
Stefan Troschuetz11-Feb-07 7:55
Stefan Troschuetz11-Feb-07 7:55 
GeneralRe: Undo() Method? Pin
sharpiesharpie11-Feb-07 9:35
sharpiesharpie11-Feb-07 9:35 
GeneralRe: Undo() Method? Pin
Stefan Troschuetz11-Feb-07 20:39
Stefan Troschuetz11-Feb-07 20:39 
AnswerRe: Undo() Method? Pin
Stefan Troschuetz11-Feb-07 7:50
Stefan Troschuetz11-Feb-07 7:50 
AnswerRe: Undo() Method? Pin
ShermansLagoon11-Feb-07 19:50
ShermansLagoon11-Feb-07 19:50 
QuestionOpacity Pin
Fco. Javier Marin11-Feb-07 4:46
Fco. Javier Marin11-Feb-07 4:46 
QuestionArrayList with restricted access Pin
Mark T.11-Feb-07 4:11
Mark T.11-Feb-07 4:11 
AnswerRe: ArrayList with restricted access Pin
Stefan Troschuetz11-Feb-07 4:30
Stefan Troschuetz11-Feb-07 4:30 
AnswerRe: ArrayList with restricted access Pin
Luc Pattyn11-Feb-07 5:43
sitebuilderLuc Pattyn11-Feb-07 5:43 
GeneralRe: ArrayList with restricted access Pin
Mark T.11-Feb-07 10:51
Mark T.11-Feb-07 10:51 
AnswerRe: ArrayList with restricted access Pin
Syed Muhammad Kamran12-Feb-07 2:02
Syed Muhammad Kamran12-Feb-07 2:02 
QuestionDisabling Windows Buttons: Minimize,Restore,Close Pin
Blekk11-Feb-07 4:06
Blekk11-Feb-07 4:06 
AnswerRe: Disabling Windows Buttons: Minimize,Restore,Close Pin
Stefan Troschuetz11-Feb-07 4:24
Stefan Troschuetz11-Feb-07 4:24 
AnswerRe: Disabling Windows Buttons: Minimize,Restore,Close [modified] Pin
sharpiesharpie11-Feb-07 4:29
sharpiesharpie11-Feb-07 4:29 
GeneralRe: Disabling Windows Buttons: Minimize,Restore,Close Pin
Blekk11-Feb-07 6:14
Blekk11-Feb-07 6:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.