Results 1 to 7 of 7

Thread: MS ACCESS with VB.NET+Connection help needed

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    24

    MS ACCESS with VB.NET+Connection help needed

    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
    No value given for one or more required parameters
    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
    Last edited by sourind; Feb 25th, 2007 at 04:49 AM.

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