I want to do 'insert' after 'truncate' on the db

I want to do ‘insert’ after ‘truncate’ on the db. But there is an error in ‘excute nonquery’. Can you tell me why?

It works well except for the ‘excute nonquery’ that contains the truncate table query.

Hi

Pls check once with the table name is correct or not

Cheers @S_Sim

1 Like

Hi @S_Sim ,

Try to use connect then non query then disconnect.
Repeat same for Insert.

1 Like

okey dokey

your means, connect db - excute non query - disconnect - connect - insert ?

connect db - excute non query - disconnect - connect - insert - disconnect

Not best approach but you can try as For DDL commands we have to open and close connection.

1 Like

Thank you.
I’ll give it a try.

I was a fool. I didn’t distinguish between capital letters.

No worries
It happens @S_Sim

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.