using datareader

izza_azhar

Member
Joined
Mar 1, 2006
Messages
17
Programming Experience
Beginner
hye all..
help me on this:
eg : variable1 = "test"
how can i remove the " " ?
and make it: variable1 = test ?
thanks~~
 
string variables always have to have the quotes (" ") around whatever contents you're assigning to the variable

if the quotes arnt there, the IDE will give you an error (or two) and your program wont compile and can't be ran
 
JuggaloBrotha said:
string variables always have to have the quotes (" ") around whatever contents you're assigning to the variable

if the quotes arnt there, the IDE will give you an error (or two) and your program wont compile and can't be ran

actually i dont know what to pass..
that one just the example..
lets go through deeply..

'MyDataReader-->pass it to the database
Dim variable1 as string

'this is my assumption only
'class, habitat = name of attributes that i get after some looping function
variable1 = : "MyDataReader("class") MyDataReader("habitat") "

so, in database it will be pass like:
Try
MyConnection.Open()
MyDataReader = MyCommand.ExecuteReader
While MyDataReader.Read()
variable1 = MyDataReader("class") MyDataReader("habitat")

if u see my assuption above, it goes like this:
"MyDataReader("class") MyDataReader("habitat") "

but the value that i want is like this:
variable1 = MyDataReader("class") MyDataReader("habitat")

(so, my assumption, i need to remove the "" only..but actually cannot rite because i use string?)

get it?
i dont know what to declare to variable1 to pass the value to the database
hope u can help me..
 
i'm quite confused, but that's because i'm not into database programming yet so i dont know how to use the database classes (such as the datareader)

i did rename the thread and move it to the data access forum so someone who is familiar with this can help
 
I am confused too ... i am not even sure why you want to remove double quotes. maybe you want to remove double quotes around datareader's index. If its so then notice that you can refer datareader by its index i.e.
VB.NET:
While MyDataReader.Read()
variable1 = MyDataReader(0).ToString & MyDataReader(1).ToString
{...}
End While

Regards ;)
 
Back
Top