hi,
In order to find the error insert a breakpoint on the line with this code:
SqlCommand cmd1 = new SqlCommand(xxxx1, c.getcon());
to figure at what is exactly in xxxx1, in order to help you find the problem.
Secondly, try to use string.Format to create a Sql query to make your work easier. Using
string.Format
helps to reduce errors while working with strings.
I hope it helps,
Cheers