Question error in sql query

swethajain

Well-known member
Joined
Feb 1, 2010
Messages
48
Programming Experience
Beginner
Hi,
I wrote a search condition to retrieve the records from from date to end date, iam getting error that "No value given for one or more required parameters."
the code is,
Imports System.Data.OleDb
Public Class Form3
Dim myConnection As OleDbConnection
Dim myCommand As OleDbCommand

Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dg1_Search.Visible = "False"

End Sub

Private Sub bt_Search_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_Search.Click
'Try
Dim fdt As String = dtp_Fromdate.Text
Dim tdt As String = dtp_Todate.Text
myConnection = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='h:\info2.mdb'")
Dim strQry As String = "select [ID],[Dt],[Res],[Construction Package],[Region],[Trade],[Location],[Network Name],[Task],[Progress],[Duration],[Assumptions] from Record where [Dt] between fdt and tdt"
myConnection.Open()


Dim ds As New DataSet
Dim da As New OleDbDataAdapter(strQry, myConnection)
da.Fill(ds, "Record")
If (ds.Tables(0).Rows.Count > 0) Then
dg1_Search.DataSource = ds
dg1_Search.DataMember = "Record"
dg1_Search.Visible = "true"
Else
dg1_Search.Visible = "false"
Label1.Text = "No Records"
End If
myConnection.Close()
'Catch ex As Exception
' MessageBox.Show(ex.ToString())
'End Try
End Sub

End Class


Please tell me the error


Thanks,
Swetha.
 
Back
Top