Hi,
I am trying to use a parameter in one of my queries but consistently get the
following error:
FbException was unhandled
Must declare command parameters.
With this statement highlighted:
daDuePacks.Fill(m_dsDocoInfo, "DuePacks")
When I load the following form:
Private Sub frmSignUpPack_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Create some more manageable names for form objects.
Dim conn As New FbConnection(FbConnection.ConnectionString)
Dim sDuePackSelect = FbCmdDuePacks.CommandText
'Prepare adapter to retrieve information from db.
Dim daDuePacks As New FbDataAdapter(sDuePackSelect, conn)
'Create the parameter in the SQL query and add it to the commands
collection.
Dim prmStartDate As New FbParameter()
prmStartDate.ParameterName = "@StartDate"
prmStartDate.FbDbType = FbDbType.TimeStamp
FbCmdDuePacks.Parameters.Add(prmStartDate)
'Set the value of the parameter to the start datepicker on the form.
FbCmdDuePacks.Parameters("@StartDate").Value = dtmStart.Value
'Add table to the Module based dataset.
daDuePacks.Fill(m_dsDocoInfo, "DuePacks")
dgSignUpPacks.DataSource =
m_dsDocoInfo.Tables.Item("DuePacks").DefaultView
End Sub
I have in the FbCmdDuePacks a select statement that looks like this:
SELECT
cl.clie_code,
cl.clie_surname,
cl.clie_given,
cl.clie_raddr,
cl.clie_rcity,
cl.clie_rpcode,
emp.empl_name,
emp.empl_baddr,
empco.emco_surname,
empco.emco_given,
qu.qual_code,
qu.qual_name
FROM
client cl,
clieeven clev,
employer emp,
employercontact empco,
qualification qu,
contract co
WHERE
cl.clie_id = clev.clie_id AND
cl.empl_id = emp.empl_id AND
cl.clie_id = co.clie_id AND
qu.qual_id = co.qual_id AND
emp.empl_id = empco.empl_id AND
clev.even_id = 85 AND
clev.clev_complete = 0 AND
empco.emco_primary = 1 AND
clev.clev_start = @StartDate;
Can someone please tell me what I'm doing wrong?
Many thanks,
Peter.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider