I know similar questions have been answered elsewhere, but they weren't much help to me. I've only been using .NET for about a week so go easy on me!

I'm trying to insert data into an MS Access database. Here is my INSERT statement:

sCmdIns = "INSERT INTO Table1 ([Date], Arrive, Depart, Lunch, LunchTime) VALUES (#{0:g}#, #{1:g}#, #{2:g}#, '{3:G}', {4:d})"

Arrive and Depart of format (hh:mm:ss)

Lunch is a string value

LunchTime is an integer

Do I need the # around date, arrive and depart? and should {3:G} be surrounded by single quotes?

Thanks

Hi styopah, your syntax looks fine. Just a bit puzzled as to the values you are trying to insert. Should look more like this:

sCmdIns = "INSERT INTO Table1 ([Date], Arrive, Depart, Lunch, LunchTime) VALUES (#01/01/11#, #09:00:00#, #17:30:00#, 'Chicken', 12)"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.