Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array help please

Status
Not open for further replies.

yama

Programmer
Jun 28, 2001
69
SG
Hi, I have just started on visual basic programming and had meet with some problem, hope someone can assist me, thanks

This is what the codes looks like

Private Sub Command1_Click()
Dim str As String
Dim i As Integer
Dim col() As String

str = "Select * from Users where UserID = '" + Text1.Text + "'"
If SQLExecDirect(hstmt, str, SQL_NTS) <> SQL_SUCCESS Then
MsgBox &quot;error SQLExecDirect&quot;
End If

For i = 0 To 10
ReDim col(0 To 10)
SQLBindCol hstmt, (i + 1), SQL_C_CHAR, col(i), sizet, temp
Next i
SQLFetch (hstmt)

For j = 0 To 10
Label1.Caption = col(j)
Next j
End Sub

it looks all rite to me but when i click the button, a fatal error occur and close my entire vb program down...
I think it might be the array problem because if i dim the array as integer, there will not be any problem...anyone can help me on this one? thanks alot
 
hmm...thanks, i try the codes but it will give me the same &quot;This program has perform an illegal operation.....&quot; message is there something wrong with my fetch or with my printing out of data?
 
hmm...its a statement to bind the database columns to the data variables.
SQLBindCol hstmt, (i + 1), SQL_C_CHAR, col(i), sizet, temp

the (i+1) is the column number, have to start from 1.
hmm... for sizet, i declare the size to be 499
 
The question is, 499 is the size of what? If it is the size of temp them temp has better be 499 whatever, bytes, characters. An size spec that is greater than the area provided sure could cause havoc, including &quot;illegal operation&quot;. Compare Code (Text)
Generate Sort in VB or VBScript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top