views:

431

answers:

2

Hey Everyone,

I am trying to connect a console application to a access database.

This is the query that i have am using:

"SELECT [Type], [Name], [Phone Number], [Start Time], [End Time], [IM Session File], [Notes] FROM [Call History] WHERE [Start Time] >= ?"

The problem is that for some reason when i take that data from the access database and put it into a sql server database the dates are messed up in the sense that they are not in order of the year.

So i decided to add a order by clause:

SELECT [Type], [Name], [Phone Number], [Start Time], [End Time], [IM Session File], [Notes] FROM [Call History] WHERE [Start Time] >= ? ORDER BY [Call History].[Start Date]

command.Parameters.Add("@date", OleDbType.Date); command.Parameters["@date"].Value = calllogClient.getLastEntryInserted(ssid);

Keep getting this exception: System.Data.OleDb.OleDbException: No value given for one or more required parameters.

I don't know how to make this work. Any suggestions would be helpful.

Thanks

A: 

I believe your select statement should be like this:

SELECT [Type], [Name], [Phone Number], [Start Time], [End Time], [IM Session File], [Notes] FROM [Call History] WHERE [Start Time] >= @date ORDER BY [Call History].[Start Date]

BFree
A: 

When setting the parameter, remove the @

command.Parameters["date"].Value = calllogClient.getLastEntryInserted(ssid);

Chris Brandsma