hi,
I am interested to convert my code from MS sql store procedures to C# and have the same resutls. All my code are inside store procedure which contains the following
1. Cursor to iterate through rows
2. Executing DTS to Export Data to Excel code :
declare @cmd varchar(200),@ZipFile
select @cmd ='dtsrun /S EH /N DtsName /UBob /Pmypassword'
exec @cmd = master..xp_cmdshell @cmd
-- Calling to execute DTS package inside store procedure
3. Executing a batch file to zip folder content:
select @cmd =null
select @cmd = 'd:\Batch_code\zip -j d:\OUT\'+@ZipFile+' d:\OUT\*.*'
exec master..xp_cmdshell @cmd
4.Move the zipped file from the production server to another server to keep my data else ware in case I lost my production server, so I have a backup copy of my data else ware:
select @cmd='move D:\OUT\'+@ZipFile+'\\PcName\BackupFolder '
exec master..xp_cmdshell @cmd
The above steps basically does the following:
1 + 2 Export the database tables to both excel file and to text file to a folder in the production server
3 will zip the files
4 will move the zip file which contain production data to another PC in the Network in case the production server crashes , so I have a backup copy of my data.
My question is how I can write the same functions in C#, any advice
thanks
Ehx
I am interested to convert my code from MS sql store procedures to C# and have the same resutls. All my code are inside store procedure which contains the following
1. Cursor to iterate through rows
2. Executing DTS to Export Data to Excel code :
declare @cmd varchar(200),@ZipFile
select @cmd ='dtsrun /S EH /N DtsName /UBob /Pmypassword'
exec @cmd = master..xp_cmdshell @cmd
-- Calling to execute DTS package inside store procedure
3. Executing a batch file to zip folder content:
select @cmd =null
select @cmd = 'd:\Batch_code\zip -j d:\OUT\'+@ZipFile+' d:\OUT\*.*'
exec master..xp_cmdshell @cmd
4.Move the zipped file from the production server to another server to keep my data else ware in case I lost my production server, so I have a backup copy of my data else ware:
select @cmd='move D:\OUT\'+@ZipFile+'\\PcName\BackupFolder '
exec master..xp_cmdshell @cmd
The above steps basically does the following:
1 + 2 Export the database tables to both excel file and to text file to a folder in the production server
3 will zip the files
4 will move the zip file which contain production data to another PC in the Network in case the production server crashes , so I have a backup copy of my data.
My question is how I can write the same functions in C#, any advice
thanks
Ehx