Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • all you need is a condition.. If..Then..Else. End If. Also try avoid to use query as string.. add parameters to your command.. You have so many ways to do this.. preprocess excel file.. or before insert, ask db, if the record exists Commented Jun 14, 2019 at 11:45
  • Set a unique constraint on the database table? Commented Jun 14, 2019 at 11:50
  • A unique constraint would work but if i wanted to add new rows for same id, same month but with different years how could i do that? Commented Jun 14, 2019 at 13:40