Click here to Skip to main content
15,887,776 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Print without prompt Pin
Dave Kreskowiak14-May-07 4:16
mveDave Kreskowiak14-May-07 4:16 
GeneralRe: Print without prompt Pin
Suhail Shahab15-May-07 20:44
Suhail Shahab15-May-07 20:44 
GeneralRe: Print without prompt Pin
Dave Kreskowiak16-May-07 13:27
mveDave Kreskowiak16-May-07 13:27 
QuestionHow to get data in column from dataset Pin
somchoto13-May-07 19:33
somchoto13-May-07 19:33 
AnswerRe: How to get data in column from dataset Pin
Sonia Gupta13-May-07 19:38
Sonia Gupta13-May-07 19:38 
AnswerRe: How to get data in column from dataset Pin
theScorp13-May-07 19:42
theScorp13-May-07 19:42 
GeneralRe: How to get data in column from dataset [modified] Pin
Sonia Gupta13-May-07 19:52
Sonia Gupta13-May-07 19:52 
GeneralRe: How to get data in column from dataset Pin
theScorp13-May-07 20:51
theScorp13-May-07 20:51 
Both have their own importance.

Lets consider an example

Suppose you are getting data from Database using a Stored procedure.
Stored procedure contains Select as..
Select ID, Name, Value from Table1

When you will use this DB procedure in the C#..
You have 2 options Either to get by Column name or by Index..
<br />
long id;<br />
String Name, Value;<br />
<br />
// using Index<br />
id = (long) lv_DtSet.Tables[0].Rows[0][0];<br />
Name = (String) lv_DtSet.Tables[0].Rows[0][1];<br />
Value = (String) lv_DtSet.Tables[0].Rows[0][2];<br />
<br />
//using Column Name<br />
id = (long) lv_DtSet.Tables[0].Rows[0]["ID"];<br />
Name = (String) lv_DtSet.Tables[0].Rows[0]["Name"];<br />
Value = (String) lv_DtSet.Tables[0].Rows[0]["Value"];<br />

Now, if you look at Index case you don't know which value u r retrieving.
So, if someday DB person changes sequence of columns say..
Select ID, Value, Name from Table1
you r in trouble. B'coz no exception will be raised.. bt Name and Value will get interchanged.

So I will prefer to use Column name in this case. B'coz Changing of column name in DB is less likely. And eventhough the Sequence of columns in Select query gets changed, u don't have to change your code.


But there are some times.. u don't know column names OR u want to read data serially Column1, column2 etc.. then use Column indexes.

Depends on situation.
But I will prefer to use Column name as far as possible.

And by the way its.. ROHAN Smile | :)



"If our Mind can, the Program can !!" ≡ ░Ŗổђầŋ٭ ≡

QuestionRe: How to get data in column from dataset Pin
Sonia Gupta13-May-07 20:55
Sonia Gupta13-May-07 20:55 
AnswerRe: How to get data in column from dataset Pin
theScorp13-May-07 21:06
theScorp13-May-07 21:06 
AnswerRe: How to get data in column from dataset Pin
somchoto13-May-07 20:33
somchoto13-May-07 20:33 
GeneralRe: How to get data in column from dataset Pin
theScorp13-May-07 20:59
theScorp13-May-07 20:59 
AnswerRe: How to get data in column from dataset [Thank YOu] Pin
somchoto13-May-07 21:27
somchoto13-May-07 21:27 
Questionminor math question Pin
crash89313-May-07 18:45
crash89313-May-07 18:45 
AnswerRe: minor math question Pin
GgAben13-May-07 22:15
GgAben13-May-07 22:15 
GeneralRe: minor math question Pin
crash89313-May-07 23:30
crash89313-May-07 23:30 
GeneralRe: minor math question Pin
The ANZAC14-May-07 2:17
The ANZAC14-May-07 2:17 
QuestionHow to remove icon Pin
Rupesh Kumar Swami13-May-07 18:35
Rupesh Kumar Swami13-May-07 18:35 
AnswerRe: How to remove icon Pin
Sonia Gupta13-May-07 19:12
Sonia Gupta13-May-07 19:12 
GeneralRe: How to remove icon Pin
Rupesh Kumar Swami13-May-07 19:20
Rupesh Kumar Swami13-May-07 19:20 
QuestionRe: How to remove icon Pin
Sonia Gupta13-May-07 19:36
Sonia Gupta13-May-07 19:36 
AnswerRe: How to remove icon Pin
Rupesh Kumar Swami13-May-07 19:43
Rupesh Kumar Swami13-May-07 19:43 
GeneralRe: How to remove icon Pin
Sonia Gupta13-May-07 20:01
Sonia Gupta13-May-07 20:01 
AnswerRe: How to remove icon Pin
harsh_c13-May-07 22:04
professionalharsh_c13-May-07 22:04 
GeneralRe: How to remove icon Pin
Rupesh Kumar Swami13-May-07 23:12
Rupesh Kumar Swami13-May-07 23:12 

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.