cmd = New SqlCommand("INSERT INTO temp_balance ( debit, credit, accname ) SELECT Sum(temp_sheet.debit) AS debit, Sum( AS credit, IIf (debit < credit ,'loss','profit') AS expr1 FROM temp_sheet group by temp_sheet.debit, ;", con)

there an error i dont know the error incorrect syntax near ' )

Recommended Answers

All 2 Replies

Member Avatar

Can you run the select separately? And same with insert, using test values? Then try the whole sql statement in SSMS. Nothing stands out as obvious error with syntax.

thank you

Be a part of the DaniWeb community

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