Results 1 to 2 of 2

Thread: Ms Acccess With Vb.net Help

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    24

    Ms Acccess With Vb.net Help

    i have a database det1,and a table in it (table2) like below
    field1 field2 field3
    12 13 14
    15 16 17
    18 19 20


    the datatypes are all "Text"

    i need to access the row whose field1=15


    when i use the following code ,i get the error
    [red]No value given for one or more required parameters[/red]
    with the line
    sa.Fill(ds, "table2")
    highlighted


    Public Function GetPupil(ByVal id As Integer)

    Dim conn As OleDb.OleDbConnection = GetConnection()
    Dim i As Integer
    i = 15
    Try
    Dim sql As String = "Select * from table2 WHERE Field1=" & i.ToString()Dim sa As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(sql, conn)
    Dim ds As New DataSet

    Try
    sa.Fill(ds, "table2")

    Finally
    sa.Dispose()
    End Try
    Return ds

    Finally
    conn.Close()
    conn.Dispose()
    End Try

    End Function


    is the line
    Dim sql As String = "Select * from table2 WHERE Field1=" & i.ToString()
    correct?? or is there anything else wrong?
    can anyone help me with this?
    thnking in advance

  2. #2
    Frenzied Member
    Join Date
    Aug 2005
    Posts
    1,042

    Re: Ms Acccess With Vb.net Help


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