I need a way to check if a table exist in my database from my C# class, and if that table got the rows needed.
If it doesn’t exist or some of the rows are missing, I need to add those.
I’ve used this method but don’t know how to get the missing functions in there.
( Check if a SQL table exists )
I’m working with SQL Server and C#
I’m going to attach a script here that will dump all the objects and columns for the objects in a TempTable. I run the same script on the DB that I’m comparing with, and check which objects doesn’t exists, and which columns in which tables does not exist, and which columns have changed. I’ve used a Delphi app very long ago then to “upgrade” my DB’s
I run this code on the MASTER database.
Then I bcp the data into a flat file
When I ran my upgrade, I create a table on the Upgrade DB with the same structure, and bcp the data of the Master DB in there.
Then I used this script then in my Delphi App to check what changed.
This should get you going.
If you need more information on the C# part of it, I can give you some code.
Here is C# code to get you going. There is some stuff that you will have to add yourself, but if you strugle, let me know.