Hey all,
I am having trouble with a query and nonquery in C# while accessing an Access database.
The query I am having problems with is using the LIKE statement in the query.
sqlString =
"SELECT * "
+ "FROM Convocations "
+ "WHERE Name LIKE \"*" + txtFilterParameter.Text + "*\""
+ "ORDER BY " + getSortField() + " " + getSortDirection();`
That works when directly pasted into Access, but for some reason not when I have it going in C#.
The nonquery I'm having trouble with at the moment is INSERT.
(The Value names are the same as the Category names, I know. I did it to keep them lined up.
string sqlStatement =
"INSERT INTO Convocations (Name, Classification, Date, Location) "
+ "VALUES ('" + Name + "', '" + Classification
+ "', '" + Date +"', '" + Location + "')";
For the INSERT statement, it is saying that it has a Syntax Error, but I debugged it and couldn't find anythign wrong.
An example return:
INSERT INTO Convocations (Name, Classification, Date, Location) VALUES ('My Birthday', 'Party', '11/16/1992 5:30:00 PM', 'My House')