sql - how to save any file in specific folder in c# programatically -


i want save backup file in specific folder. i'm using savefiledialog box give path , file name on button click. want create backup giving name (datetime.today.date.toshortdatestring()) , save in "d:\database" directly on button click. , don't want use savefiledialog box. i'm using code:

sqlcommand cmd = new sqlcommand("use master backup database plproject disk = '" + savefiledialog1.filename + "'", connectionsql); 

i guess looking this

public static void writealltext(     string path,     string contents )  file.writealltext("d:\\database\\"+datetime.today.date.toshortdatestring(),yourdatastring); 

note: overwrite file same name.

there many other useful methods available in file class. can check suits best.

edit 1

try this

string filename="d:\\backup\\"+datetime.today.date.toshortdatestring(); sqlcommand cmd = new sqlcommand("use master backup database plproject disk = '" + filename + "'", connectionsql); 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -