Click here to Skip to main content
15,883,901 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Newby to ADO.NET needs help upgrading from VB6 recordset update batch Pin
Eddy Vluggen5-Feb-12 19:45
professionalEddy Vluggen5-Feb-12 19:45 
QuestionDataReader with SQL Join Pin
C#Coudou2-Feb-12 19:51
C#Coudou2-Feb-12 19:51 
AnswerRe: DataReader with SQL Join Pin
Wayne Gaylard2-Feb-12 20:26
professionalWayne Gaylard2-Feb-12 20:26 
GeneralRe: DataReader with SQL Join Pin
C#Coudou2-Feb-12 21:13
C#Coudou2-Feb-12 21:13 
GeneralRe: DataReader with SQL Join Pin
Simon_Whale2-Feb-12 21:54
Simon_Whale2-Feb-12 21:54 
GeneralRe: DataReader with SQL Join Pin
C#Coudou2-Feb-12 21:57
C#Coudou2-Feb-12 21:57 
GeneralRe: DataReader with SQL Join Pin
Wayne Gaylard2-Feb-12 22:13
professionalWayne Gaylard2-Feb-12 22:13 
AnswerRe: DataReader with SQL Join Pin
Johan Hakkesteegt2-Feb-12 23:35
Johan Hakkesteegt2-Feb-12 23:35 
Hi,

Wayne's suggestion is viable, but using index numbers instead of field names is not recommended, because your code will become harder and harder to maintain, when you add more fields to your query.

Generally speaking you may want to adapt your code thus:

VB
If sqlRead.HasRows Then 
   Dim str as String = String.Empty
   Do While sqlRead.Read()
      str = sqlRead.Item("FID").ToString
      ' Do something with str here or outside the Do loop, when you expect only a single result
   End While
End If


If your query has only a single field with the name FID, the DataReader will automatically translate FID to TABLE1.FID.

Just as a matter of interest, are you using MS SQL or some other DB, because I can't get your query to work? In other words, what I am wondering is, the problem may simply be the query, and not so much the code.

Cheers,
Johan
My advice is free, and you may get what you paid for.

AnswerRe: DataReader with SQL Join Pin
Dave Kreskowiak3-Feb-12 2:28
mveDave Kreskowiak3-Feb-12 2:28 
Questionvb.net Pin
Member 82843502-Feb-12 18:58
Member 82843502-Feb-12 18:58 
AnswerRe: vb.net Pin
Simon_Whale2-Feb-12 21:50
Simon_Whale2-Feb-12 21:50 
AnswerRe: vb.net Pin
Eddy Vluggen3-Feb-12 0:22
professionalEddy Vluggen3-Feb-12 0:22 
QuestionCopy Content from Word Docuemnt to RichBox Pin
Peace4all2-Feb-12 17:50
Peace4all2-Feb-12 17:50 
AnswerRe: Copy Content from Word Docuemnt to RichBox Pin
Wayne Gaylard2-Feb-12 19:19
professionalWayne Gaylard2-Feb-12 19:19 
Questionshow/hide datagridview rows by setting trackbar value Pin
bezkintos2-Feb-12 14:09
bezkintos2-Feb-12 14:09 
AnswerRe: show/hide datagridview rows by setting trackbar value Pin
Luc Pattyn2-Feb-12 15:07
sitebuilderLuc Pattyn2-Feb-12 15:07 
GeneralRe: show/hide datagridview rows by setting trackbar value Pin
bezkintos3-Feb-12 11:51
bezkintos3-Feb-12 11:51 
GeneralRe: show/hide datagridview rows by setting trackbar value Pin
Alan N3-Feb-12 13:01
Alan N3-Feb-12 13:01 
GeneralRe: show/hide datagridview rows by setting trackbar value Pin
bezkintos3-Feb-12 14:43
bezkintos3-Feb-12 14:43 
AnswerRe: show/hide datagridview rows by setting trackbar value Pin
Luc Pattyn4-Feb-12 3:30
sitebuilderLuc Pattyn4-Feb-12 3:30 
GeneralRe: show/hide datagridview rows by setting trackbar value Pin
bezkintos4-Feb-12 6:22
bezkintos4-Feb-12 6:22 
AnswerRe: show/hide datagridview rows by setting trackbar value Pin
Luc Pattyn4-Feb-12 6:43
sitebuilderLuc Pattyn4-Feb-12 6:43 
GeneralRe: show/hide datagridview rows by setting trackbar value Pin
bezkintos4-Feb-12 7:51
bezkintos4-Feb-12 7:51 
AnswerRe: show/hide datagridview rows by setting trackbar value Pin
Luc Pattyn4-Feb-12 8:02
sitebuilderLuc Pattyn4-Feb-12 8:02 
GeneralRe: show/hide datagridview rows by setting trackbar value Pin
bezkintos4-Feb-12 8:34
bezkintos4-Feb-12 8:34 

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.