Click here to Skip to main content
15,887,214 members
Home / Discussions / C#
   

C#

 
GeneralRe: Invoking Progressbar Pin
SimpleData9-Oct-09 22:31
SimpleData9-Oct-09 22:31 
GeneralRe: Invoking Progressbar Pin
DaveyM6910-Oct-09 0:42
professionalDaveyM6910-Oct-09 0:42 
GeneralRe: Invoking Progressbar Pin
SimpleData10-Oct-09 0:44
SimpleData10-Oct-09 0:44 
GeneralRe: Invoking Progressbar Pin
Luc Pattyn10-Oct-09 1:52
sitebuilderLuc Pattyn10-Oct-09 1:52 
AnswerRe: Invoking Progressbar Pin
Abhijit Jana9-Oct-09 10:35
professionalAbhijit Jana9-Oct-09 10:35 
Questionan exception with this code Pin
Mohamed El-Wehishy9-Oct-09 8:49
Mohamed El-Wehishy9-Oct-09 8:49 
AnswerRe: an exception with this code Pin
Not Active9-Oct-09 8:57
mentorNot Active9-Oct-09 8:57 
GeneralRe: an exception with this code Pin
Mohamed El-Wehishy9-Oct-09 9:09
Mohamed El-Wehishy9-Oct-09 9:09 
ok man this is my code

private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                SqlConnection cn = new SqlConnection("initial catalog=vvvvvvvvvvv;server=.;integrated security=sspi");
                SqlCommand cmd = new SqlCommand("back_up_database", cn);
                cmd.CommandType = CommandType.StoredProcedure;

                cn.Open();

                int i = cmd.ExecuteNonQuery();

                cn.Close();



                if (i > 0)
                {
                    MessageBox.Show("Your database is backed up");
                }
            }
            catch(Exception ex)
            {
                MessageBox.Show("Sorry we can not back up your database");
            }
        }


when i run this code it throw exception
but when i execute the stored procedure

ALTER proc [dbo].[back_up_database]
as
ALTER DATABASE [vvvvvvvvvvv]
SET OFFLINE
go
BACKUP DATABASE [vvvvvvvvvvv]
TO DISK = 'D:\SQLServerBackups\vvvvvvvvvvv.Bak'
with NO_COMPRESSION
go
ALTER DATABASE [vvvvvvvvvvv]
SET ONLINE
go


it completed successfully

so what is wrong

thanks for your interest

Mohamed El-Wehishy
GeneralRe: an exception with this code Pin
Not Active9-Oct-09 9:33
mentorNot Active9-Oct-09 9:33 
GeneralRe: the exception Pin
Luc Pattyn9-Oct-09 10:01
sitebuilderLuc Pattyn9-Oct-09 10:01 
GeneralRe: the exception Pin
Mohamed El-Wehishy9-Oct-09 10:11
Mohamed El-Wehishy9-Oct-09 10:11 
GeneralRe: the exception Pin
Not Active9-Oct-09 10:31
mentorNot Active9-Oct-09 10:31 
GeneralRe: the exception Pin
Not Active9-Oct-09 10:35
mentorNot Active9-Oct-09 10:35 
GeneralRe: the exception Pin
Luc Pattyn9-Oct-09 11:13
sitebuilderLuc Pattyn9-Oct-09 11:13 
AnswerRe: an exception with this code Pin
EliottA9-Oct-09 9:01
EliottA9-Oct-09 9:01 
AnswerRe: an exception with this code Pin
Md. Marufuzzaman9-Oct-09 9:08
professionalMd. Marufuzzaman9-Oct-09 9:08 
QuestionChange color of ribbon control..... Pin
yogeshdew9-Oct-09 6:28
yogeshdew9-Oct-09 6:28 
AnswerRe: Change color of ribbon control..... Pin
Henry Minute9-Oct-09 9:11
Henry Minute9-Oct-09 9:11 
QuestionA question on inheritance again Pin
Dewald9-Oct-09 4:45
Dewald9-Oct-09 4:45 
AnswerRe: A question on inheritance again Pin
EliottA9-Oct-09 4:48
EliottA9-Oct-09 4:48 
GeneralRe: A question on inheritance again Pin
PIEBALDconsult9-Oct-09 4:52
mvePIEBALDconsult9-Oct-09 4:52 
GeneralRe: A question on inheritance again Pin
EliottA9-Oct-09 5:01
EliottA9-Oct-09 5:01 
AnswerRe: A question on inheritance again Pin
dan!sh 9-Oct-09 4:53
professional dan!sh 9-Oct-09 4:53 
AnswerRe: A question on inheritance again Pin
PIEBALDconsult9-Oct-09 4:53
mvePIEBALDconsult9-Oct-09 4:53 
AnswerRe: A question on inheritance again Pin
Keith Barrow9-Oct-09 5:45
professionalKeith Barrow9-Oct-09 5:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.