|
public string deleteDB(string strSelect)
{
try
{
cmd.Connection = objConn;
cmd.CommandText = strSelect;
cmd.ExecuteScalar();
}
catch (SqlException eException)
{
Console.Write("Error in connection : " + eException.Message);
return -10;
//return strSelect;
}
}
|
|
|
|
|
Well, did you read the error message ? Your function returns a string, and you're tring to return -10. Which is both stupid ( what does -10 mean ? ) and illegal ( an int is not a number ). The logical thing to return here is probably a bool. Why bother returning the string that was passed in ?
Where does strSelect come from ? This looks silly to me from the get go. You're just taking SQL as a string and calling it, this should not exist at all, but if it did, it should have a generic name, there is not guarentee it will delete anything.
There is so much wrong with this, you should probably go back to basics and do some reading. But, to fix the problem at hand, read your error messages and believe them. You said you were returning a string. The compiler won't turn an int to a string, so return a string, or change the return type. And, return something when the code doesn't blow up, too.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: an int is not a number
You mean string
|
|
|
|
|
*sigh* yes, I did...
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
your trying to return an int in a method that needs to return a string... youl have to return "-10" in your catch block...
and use PRE tags when posting code please
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
-10 is a int not a string
|
|
|
|
|
Hello everyone,
I need some help here, maybe lots.
Want a quick way to upload images to tinypic dot com from within windows.
Its a free image hosting site. Hope I am not breaking any rules here by typing the site name.
I can think of doing this with right-click context menu.
I am a newbie in programming. This is what I have come up with so far.
Regedit : HKEY_CLASSES_ROOT\jpegfile\shell
Can add a KEY as "Upload to TinyPic". Right click "Upload to TinyPic" and add another key "command".
Right click any jpg/jpeg image file and you'll see the option "Upload to TinyPic" in the context menu.
Now what command to use so that whenever I click on that, the pic will get uploaded to the site and the uploaded site opens up showing the links or something like that.
A friend of mine told me, it can be done thru programming. So thats the reason, I am here. I don't know any programming, so give me codes and stuffs to do that. Just let me know something easy a normal person like me can use.
Kindly help me out.
Thanks a lot.
|
|
|
|
|
You're not in Kansas anymore. I recommend asking your friend to write this for you. No-one here is going to do it. Your command would be the path to the program you write to upload the files.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Maybe it uses ShellExt or something like that. My friend is not that of a programming expert as me, but we know some names, thats all.
Maybe you can do it for me. If thats not a BIG problem for you.
My guess is - this shouldn't be a big thing. Im asking for a favor
Thx
|
|
|
|
|
Sazarella wrote: My friend is not that of a programming expert as me, but we know some names, thats all.
OK, so you're both out of your depth ? If you're interested, why not do some reading and try to learn ?
Sazarella wrote: My guess is - this shouldn't be a big thing.
Well, first step is to find out if the site you're talking about even exposes a web service or other way to do what you want. Then, it's probably mostly trivial, but still more work than I can spare time for, sorry. I could easily answer 20 questions here in that time, and I don't really, strictly speaking, have time to even do that.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
"If you're interested, why not do some reading and try to learn ?"
Yeah! I am interested. Where to start from? Hope its not too hard to learn. And I can do what I am looking for.
"Well, first step is to find out if the site you're talking about even exposes a web service".
How to do that?
|
|
|
|
|
You go to the web site and look around for documentation for developers.
Then you need to buy a basic C# book, if that's the level you're at, and work through that so you have a basic idea how to create an app. Then you read up on the docs on how to interact with the site, and write something based on their samples. If they exist.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Well, start with what Christian said, look at the site for developer documentation, see if they provide a web service for file uploads. Assuming that they do, next step is to download visual studio express (free from Microsoft, just Google it) and get yourself a beginners C# book.
You'll need to write an app that takes a path to a file as a command line parameter. You can setup your context menu entry to pass the file pate to your app. The app then needs to read the file, and call the webservice, passing the file and any options as specified by the sites developer docs.
It's not a difficult app to write, but if you've never programmed before there's quite a bit to learn. You need to start with the programming basics like what is a compiler, then data types and so on.
Good luck.
Simon
|
|
|
|
|
ok simon.. I got the visual studio express.
Installed it - but don't know anything on it yet.
Now .. what book to look for? Can u suggest me some which can teach me how to do programming using visual studio? Hope its available on the net as ebook. A direct link would be just so-good. But guessing from the past responses, thats hard.
I am a beginner. So guess I need to start learning. Kindly suggest me something which will be helpful (closest to this query regarding upload image).
Thx
|
|
|
|
|
OK, programming isn't easy. it takes a lot of hard work to become good at it. Many people here have been programming since they were teenagers, and still have loads to learn. I myself have been programming since I was around 11, I'm now 25 (that's 14 years, 3 doing a CS degree and 3 professionally) and still consider myself inexperienced.
Don't think that you are going to find a book or website that just tells you how to do what you are looking for. If you just want a quick program written for you, the best thing really is to try sites like rent-a-coder where you can pay people (often quite cheaply) to write software for you.
On the other hand, if you want to learn programming for more than just this quick app, and you really want to try it out you can try these links
Microsoft have a C# programming guide:
http://msdn.microsoft.com/en-us/library/67ef8sbd.aspx[^]
Start at the top (Inside a C# Program) and work down. Do the code samples. Get used to running programs in visual studio, learn about debugging with break points and stepping through code.
If you don't like the MS site Google for others, there are about a million beginner c# sites out there. Or try a book, there a loads here[^]. I can't really recommend any as I learnt programming before C# was around.
Once you've worked through some beginner tutorials you can start looking at more advanced stuff. By this stage you should know if programming is for you or not. If you are enjoying it, keep reading more, you can never read too much.
I can give you a few tips on what things you need to learn to do your program however:
1) All programming involves variables (where you store data), data types (the type of data you can store in which variables) and conditional statements (If/else) and control flow statements (For/While), so get to know these inside out.
2) You are going to need to learn about command line arguments. You'll probably pass the path to your file as a command line argument from your right click menu button.
3) Next you're going to need to know about files. Learn how to read file data in, what type of data you get (streams and byte arrays) and how to work with it. .Net[^] provides a nice simple set of classes for working with files. Learn about these.
4) Now your going to need to understand web services. Web services are basically a way of passing data to an online service. You will need to ask the website you were talking about if they provide a web service or API for uploading files. They will be able to give you details of the web service, they may even have samples on how to call it. Knowing about web services will help you here.
5) Along the way, you'll find it all much easier if you can learn and understand objects. C# is what we call an 'object oriented[^]' language, this means that data and functionality are grouped into objects that contain data and the code that works with that data. Understand this and you'll find things much easier.
When you get stuck, ask specific questions. People here will help you much more with specific questions rather than vague 'how do I write this program' style questions.
Good luck.
Simon
|
|
|
|
|
Sazarella wrote: I don't know any programming, so give me codes and stuffs to do that. Just let me know something easy a normal person like me can use.
So what would you do with them if someone (stupidly) gave you some code blocks? Have you a compiler? Do you have any idea what you are talking about?
If you want work doing then grit your teeth, get your wallet out and pay for it.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
ok .. guessing you know exactly what im looking for. So how much it will cost me?
|
|
|
|
|
No idea, I wasn't offering - this is not a job site. Try www.rentacoder.com, you will find someone there.
My point was, you admit you are not a programmer, nor is your 'knowledgable' friend, so what is the point of asking for code? The people who provide answers on here are (mostly) professional developers who try to help those less experienced, for free, and so are unlikely to provide full working applications, which is what yuo really need.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
ok i got your point.
can u answer this for me?
----------
ok simon.. I got the visual studio express.
Installed it - but don't know anything on it yet.
Now .. what book to look for? Can u suggest me some which can teach me how to do programming using visual studio? Hope its available on the net as ebook. A direct link would be just so-good. But guessing from the past responses, thats hard.
I am a beginner. So guess I need to start learning. Kindly suggest me something which will be helpful (closest to this query regarding upload image).
Thx
----------
|
|
|
|
|
i am creating System Configurator as i saw Dotnetpanel they have a configurator which download the Update and in the update they have setup.dll. which run when we install the update how i can do this.
as i remove the dll before installing the update its give error message while installing the update. i think that all the method that is used to install the new update is inside that dll can u tell me how it work [Frown]
wasim khan
|
|
|
|
|
You will have to run the update 'dll' in a separate process.
|
|
|
|
|
how can u guide me a little
wasim khan
|
|
|
|
|
We have a java web app that I need to connect to via an Office Add-in.
I have added a WCF service reference for a non secure web service and can succesfully call methods on that service.
I also need to call a couple of methods on a secure web service, ie. one that is expecting a soap header like this:-
<soap:Header xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:Security>
<wsse:UsernameToken>
<wsse:Username>username</wsse:Username>
<wsse:Password Type="wsse:PasswordText">password </wsse:UsernameToken>
</wsse:Security>
After much research I believe I need to go about this by making use of Username Tokens via Transport-based Security http://www.theserverside.net/tt/articles/showarticle.tss?id=SecuringWCFService[^]
I have ammended my basicHttpBinding to have security mode of TransportWithMessageCredential and my endpoint address starts https://. However when I try and call a method on the service I get the following error:-
'{Security}http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd was not undertsood by the service.'
My calling code looks like this:-
DocumentService.documentServiceClient client = new DocumentService.documentServiceClient();
client.ChannelFactory.Credentials.UserName.UserName = "MyUserName";
client.ChannelFactory.Credentials.UserName.Password = "MyPass";
Does anyone have experience of this problem?
Is there something on the client side I can do to resolve this?
thks
Simon
|
|
|
|
|
Could not find a straightforward way of doing this client side.
This is now working but only after a change on the java side to add "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" to the list of understood headers.
|
|
|
|
|
I wanna allow only number for my TextBox1.Its can only insert 7 digits.If I enter "23ddddd" on my TextBox1 i wanna give an error message for that.So please help me...........
CheeN
|
|
|
|