Help with database connection

girishnair12345

New member
Joined
Dec 11, 2010
Messages
4
Programming Experience
Beginner
Please help, Tell me how to make and retrieve data from database and pass numbers as column names.

I am using VB 2008 and used
SQLStr = "SELECT * FROM my_table Where column_name " & byt_loop
SQLCmd.CommandText = SQLStr
SQLdr = SQLCmd.ExecuteReader
If SQLdr.Read() Then
sng_CIR = SQLdr(byt_term - 9)
End If
SQLdr.Close()
:(
and getting an error Index was outside the bounds of the array.
 
Please help, Tell me how to make and retrieve data from database and pass numbers as column names.

I am using VB 2008 and used
VB.NET:
 SQLStr = "SELECT * FROM my_table Where column_name " & byt_loop
and getting an error Index was outside the bounds of the array.

hi i think your missing the '=' next to column_name
 
Its a mistake i forgot to add here in this forum

No the error is not there its in line sng_CIR = SQLdr(byt_term - 9)

can any one tell me a new way to accessing the stored data in database
 
hi, i think your question is a little hard to answer given the lack of clarity in what its supposed to do / what you are trying to archieve. Please also explain what is the purpose of 'byt_term - 9'
 
The term 'byt_term - 9' gives us a number
the SQLdr() function takes input as column name as a string or the 0 based column ordinal number
so 'byt_term - 9' returns a maximum number if 31 and columns in 40
i have changed the byt_term to return the output less that 31 also but its not working its giving the same error

can you tell a new way of retrieving data from table
 

Latest posts

Back
Top