Results 1 to 2 of 2

Thread: recordset trouble

  1. #1

    Thread Starter
    Hyperactive Member wolfrose's Avatar
    Join Date
    Aug 2002
    Location
    Indiana
    Posts
    309

    recordset trouble

    I'm writing a program that runs a sql query, and puts those fields into a long string. Since I am new to .NET ( I'm used to ADODB in VB 6 ), I can't get it to work.
    Can someone give me an example on how to run a query and go through the recordset, or dataset, and add it to a string?

  2. #2

    Thread Starter
    Hyperactive Member wolfrose's Avatar
    Join Date
    Aug 2002
    Location
    Indiana
    Posts
    309
    ok, I got this far, but I am getting a "Specified Cast Not Valid" Error.

    VB Code:
    1. Dim sString(1) As String
    2. Dim dr As OleDbDataReader
    3. Dim iRow As Integer
    4. Dim x As Integer = 0
    5.  
    6. Try
    7.             While dr.Read
    8.                 iRow += 1
    9.                 If iRow Mod 100 = 0 Then
    10.                     x += 1
    11.                     ReDim Preserve sString(UBound(sString) + 1)
    12.                 End If
    13.                 sString(x) = String.Concat(sString(x), dr.GetString(0))
    14.             End While
    15.         Catch ex As Exception
    16.             Console.Write(ex.Message)
    17.         End Try

    Any suggestions??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width