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
Post a Comment