![]() |
Public Member Functions | |
int | CopyTable (string Source, string Destination, string Table) |
Copying SQL server tables between data base More... | |
int | TableSchemaCopy (string Table, string Source, string destination) |
This method creates a table schema from the source data table from the specified table of the user More... | |
int | destinastionTableSchema (string Table, string destination) |
Checks for a destination table More... | |
Private Member Functions | |
void | CreateDestinationTable (DataTable DT, string Destination, string Table) |
This Method use the source data table schema to create a table in the destination with the same properties More... | |
string | Net_to_SQL (string NetType, int MaxLenght) |
This method is use to map the .Net data types to the SQL Server types. More... | |
Private Attributes | |
int | CopytableStatus = 0 |
int DataBaseTransfer.DataBaseTransferManager.CopyTable | ( | string | Source, |
string | Destination, | ||
string | Table | ||
) |
Copying SQL server tables between data base
<method="CopyTable"></method>
Source | |
Destination | |
Table |
Creating a connection to the source ///
Creating a connection to the destination ///
Opening source connection ///
Begin transaction ///
SQL command for the source table ///
Create a data table for the source data ///
Add the rows in the source data table from the source table ///
Copies the structure and data from the source data table to the destination data table ///
inserting the data into each rows of the source data table ///
Gets the current row state with relation to the DataRow ///
SQL command for the destination table ///
Building the destination command to execute ///
Opening Destination connection ///
Updating the value in the destination database by executing a update statement ///
Close source connection ///
Close destination connection
Rollback transaction ///
|
private |
This Method use the source data table schema to create a table in the destination with the same properties
DT | |
CreateDestinationTable | |
Table |
starting the building of the table string ///
Cycle through the column collection of the source table ///
Adding the column ///
Mapping the source column and converting to a SQL server syntax ///
Adding the identity information ///
Adding the AllowNull information ///
Adding a primary key to the table if it already exists ///
Adding the column to the primary key ///
SQL command to execute and create the table in the destination database ///
int DataBaseTransfer.DataBaseTransferManager.destinastionTableSchema | ( | string | Table, |
string | destination | ||
) |
Checks for a destination table
Table | |
destination |
Creating a connection to the source ///
Creating data table ///
Getting table schema ///
|
private |
This method is use to map the .Net data types to the SQL Server types.
<method="Net_to_SQL"></method>
NetType | |
MaxLenght |
int DataBaseTransfer.DataBaseTransferManager.TableSchemaCopy | ( | string | Table, |
string | Source, | ||
string | destination | ||
) |
This method creates a table schema from the source data table from the specified table of the user
<method="TableSchema"></method>
Table | |
Source |
Creating a connection to the source ///
Creating data table ///
Getting table schema ///
Attempt to create a table in the destination database ///