Results 1 to 4 of 4

Thread: There is no row at position 0. VB 2008

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2004
    Posts
    53

    There is no row at position 0. VB 2008

    Having a problem with program saying there is nothing at row 0. I know there is but it says there is not. I am using SQL Server compact 3.5 sp1. I am following the HomeAndLearn Tutorial for access, so maybe the problem is that it is using access and I am using SQL Server CE?

    Uploaded image of error

    Code:
    Public Class Form1
    
        Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click
            Dim con As New OleDb.OleDbConnection
            Dim ds As New DataSet
            Dim da As OleDb.OleDbDataAdapter
            Dim sql As String
            con.ConnectionString = "Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=|DataDirectory|\addressdb.sdf;"
    
            con.Open()
            MsgBox("A Connection to the Database is now open")
    
            sql = "SELECT * FROM AddressBookT"
            da = New OleDb.OleDbDataAdapter(sql, con)
            da.Fill(ds, "AddressBook")
    
            con.Close()
            MsgBox("The Connection to the Database is now Closed")
    
            txtFirstName.Text = ds.Tables("AddressBook").Rows(0).Item(1)
    
        End Sub
    Attached Images Attached Images  
    To save on queries thank you for your help if you helped me.

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