|
hi guys
when i run this code it throw an exception
but it run well inside SQL Server 2008
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
so what is the problem
thanks,
Mohamed El-Wehishy
|
|
|
|
|
Mohamed El-Wehishy wrote: when i run this code
What do you mean? Run it where/how?
Mohamed El-Wehishy wrote: it throw an exception
What exception?
only two letters away from being an asset
|
|
|
|
|
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
|
|
|
|
|
Read the previous response. What is the exception that is being thrown????
only two letters away from being an asset
|
|
|
|
|
why, WrongForumException, the most popular of all; what else could it be?
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
hi guys
please redirect me to a link or tutorial which help me
i can not understand the reason
thanks
Mohamed El-Wehishy
|
|
|
|
|
You can't understand the reason for what? You still haven't given any useful information
only two letters away from being an asset
|
|
|
|
|
I wouldn't say that. The original post should have made in clearer, but it does appear to be C# related question. If he/she could only understand what an exception is, we'll all know more.
only two letters away from being an asset
|
|
|
|
|
You're right. While the OP started with SQL in the C# forum, it now figures in the DB forum showing C# code;
and we may be about to find out what the exception is.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Don't you think maybe this belongs in the Database section as opposed to the C# section?
|
|
|
|
|
You should post it to the General Database forum..
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
Hi,
i have RibbonControl.dll, used in my application. but i want to change the base color of this ribbon control. look at this demo project which i have downloaded from codeproject.com itself.
http://www.codeproject.com/KB/WPF/ribboncontrol/ribboncontrol_demo.zip
can any body help me out..
Thanks!
|
|
|
|
|
At the bottom of the article that you got the RibbonControl from, you will see a section for messages. Those messages go directly to the author of the code.
If anyone knows the answer to your problem he/she's the guy/gal.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I feel I should know the answer to this but I rarely use inheritance aggressively and now I'm stuck on a basic concept.
Let's say I have an interface so I can inherit from it from a number of inheriting classes. Each will implement certain functions as defined by the interface. So far so good. Now let's say there is one function that I want to be the same for all inheriting classes. Is it really necessary to implement the function in every inheriting class? Isn't there a way I could implement the function once so that every class which inherits this interface already has the implemented function?
Your help is appreciated.
|
|
|
|
|
You don't inherit interfaces, you implement them. An interface can be thought of as a contract, it dictates to a class what methods, functions and actions it must make use of.
|
|
|
|
|
Good, I didn't want to have to say that again.
|
|
|
|
|
I figured by his post he still doesn't grasp this concept, which is understandable from a beginners point of view. Especially if he came from Java. Hopefully, it's the last time.
|
|
|
|
|
Doesn't Abstract class does that?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Have an abstract class implement the interface, then derive from that.
|
|
|
|
|
Dewald wrote: feel I should know the answer to this but I rarely use inheritance aggressively
Well you should, but remember to Favour Composition over inheritance[^]
The following should help with your question:
public interface IFoo
{
void Common();
void Different();
}
public abstract class Bar : IFoo
{
void Common()
{
}
public abstract void Different();
}
public abstract class Baz : Bar
{
public abstract void Different()
{
}
}
public abstract class Quux : Bar
{
public abstract void Different()
{
}
}
but also you should look uup the new (here[^]) and virtual (here[^]) modifiers too
CCC solved so far: 2 (including a Hard One!)
|
|
|
|
|
Hai
I am developing an C# application(not asp.net) in which I have to get the urls typed by the user in the browser and I have to compare the urls with a set of urls and decide whether to allow or to deny the user to navigate to the website.
I have tried with appending to C:\windows\system32\drivers\etc\hosts file but its not working.So Is there any way I can do this?How to block the sites by getting the urls.Can someone suggest me how to approach to the solution with some sites or code that can help me.
Thank You
Chaithu
|
|
|
|
|
The hosts file should work fine if you point those websites to something like 127.0.0.1 or a website on your intranet informing them the site is blocked.
|
|
|
|
|
Are you sure, I thought that file only was read at boot time? I haven't messed with it in a few years though, much better adblock options now.
The latest nation. Procrastination.
|
|
|
|
|
Again, haven't tested but I'm pretty sure. It's a method I employ quite often.
|
|
|
|
|
chaithusworld wrote: I have tried with appending to C:\windows\system32\drivers\etc\hosts file but its not working.
Depends on how and what you are appending. If you are doing this correct, it will work.
Still, if the user goes and deletes the entry manually, can access the website. If you are creating something like a firewall for a network, you should look into routing and remote access service. I guess are some API that can help.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|