|
Oh yes, u're right . My bad :P
The // was added for you guys only, so that the logic could be better viewable for u.
ps: The error's still there. The error is "incorrect syntax near INT, must declare the scalar variable @naim"
|
|
|
|
|
paddymega wrote: The error is "incorrect syntax near INT, must declare the scalar variable @naim"
You could look up the syntax in the documentation[^]. I'm guessing that the parameters need to be declared like in the documentation; the example I gave was not tested, and according to the docs, the parametername should precede the type, like this;
CREATE PROCEDURE EDITROW (@naim INT, @aig INT, @fmno INT, @doab INT)
AS
BEGIN
UPDATE elecdb
SET name=@naim,
age=@aig,
fammemno = @fmno,
dob = @doab
WHERE dob = @doab;
END
If you have more errors, feel free to post them; but please include your actual version of the code, and the error-message; that way you'll get the most (useful) replies.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
|
You're welcome
|
|
|
|
|
Tutorial[^]
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I want to know how to show message from window serviece
|
|
|
|
|
Windows services do not display messages. At all.
A service is something that runs before the user even logs on; that means that there is no user to view your message, and no desktop to display it. The service even runs under a different account; open "Services" from the Admin-section in the config-panel, find your service, look at the second or third tab; that's where the username/password is specified for the account that the service is running under.
The default approach is to create a second app that runs under the users' credential, and have it communicate with the service. I'd recommend TCP/IP for that, but there are more ways to communicate.
Main question here is whether you actually "need" a service. So, what does your service do, and how would a "message" look like?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
ashjassi wrote: show message
If you mean show a messagebox, you don't. Services do not interact with users by design.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
As already stated, a Windows Service is designed to run in the background without a UI and is best suited for tasks that do not need user interaction or even a user session. If at all you have to show a message and interact with the user, you may consider writing a windows application instead of a windows service.
|
|
|
|
|
Windows Service dn't show message. if you show message you can write LOg FIle or you store message to DB
Vijay
|
|
|
|
|
Hello, am new to C# programming, and would like to develop a small application with an in-built scheduler which would for example daily wake up my PC from sleep mode at 8AM and go to sleep mode at 10PM, the same routine going on the next day from Mon to Fri every week.
I do know about using Task Scheduler in Windows 7, but here would like to do it programmatically using C#. Anyone can help me finding the exact codes to perform this?
Thx...
|
|
|
|
|
This[^] is an article that shows you how to put the computer into sleep mode.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
lordrt wrote: I do know about using Task Scheduler in Windows 7,
The task manager is for starting applications; you could write an application that shuts the computer down, but waking it up is a lot more challenging.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
See here: Wake the PC from standby or hibernation[^] - it goes through the process and code pretty well.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
|
Hello,
I am trying to learn functions in C#. I wrote the following test functions and I am getting the error: Error 1 An object reference is required for the non-static field, method, or property 'Testing_Functions.Program.Test(double, double, double)' C:\Users\computerpublic\AppData\Local\Temporary Projects\Testing Functions\Program.cs 18 29 Testing Functions.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Testing_Functions
{
class Program
{
public Double Test(Double Val1, Double Val2, Double Val3)
{
Double Test_Val = Val1 + Val2 + Val3;
return Test_Val;
}
static void Main(string[] args)
{
Double A = 1, B = 2, C = 3;
Double Result = Test(A,B,C);
}
}
}
|
|
|
|
|
You have to declare the Test method as "static", just like your Main method.
Either that, you have to new up an instance of the Program class and use the Test method through that.
Serisouly, this is C# 101 stuff. You really need to pick up a beginners book on C# and work through it.
|
|
|
|
|
I am using the a book and I am following the example. I don't know why I am getting the error.
|
|
|
|
|
Look up the keyword "static", as that is why you are getting that particular error.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
You're trying to call an instance method on an implicit this, but Main is static so there is no this.
|
|
|
|
|
The function "Main " is the start point of the program. When "Main " is called, no instance of any object could yet be created, hence it must be static .
From a static method, you can reach other static methods. Or you can create an object. When you create a e.g. new Windows Forms application in Visual Studio, it adds a line to Main : Application.Run(new Form1()); . This creates a new object of type Form1 .
Similarly, you could write another class, create the corresponding object, and call its function, e.g.
namespace Testing_Functions
{
class Addition
{
public Double Test(Double Val1, Double Val2, Double Val3)
{
Double Test_Val = Val1 + Val2 + Val3;
return Test_Val;
}
}
}
and then call it from your Main method:
Addition a = new Addition();
Double Result = a.Test(A,B,C);
|
|
|
|
|
I think it's been explained pretty well already, but just in case...
static methods are available without an instance of the class. Non static methods are only available through an instance of the class.
This gives you two options in your case. Either
1. Make the Test method static
public static Double Test(Double Val1, Double Val2, Double Val3)
or
2. Create a new instance of the class that holds the method (Program in this case).
Double Result = new Program().Test(A,B,C);
alternative
Program program = new Program();
Double Result = program.Test(A,B,C);
|
|
|
|
|
What is the C# equivalent to the following VB.NET code?
Delegate Sub SetStatus(ByVal Text As String)
Private Sub SetStatusStrip(ByVal Text As String)
Dim d As New SetStatus(Sub()
End Sub)
Me.Invoke(d, New Object() {Text})
End Sub
|
|
|
|
|
This seems homeworky but since you could just whip it through an autotranslater anyway, here you go:
delegate void SetStatus(string text);
private void SetStatusStrip(string text){
Invoke(text => {
}, new object[] { text } );
}
I think that's right. Invoke is a bit sniffy sometimes, you might need to cast the lambda, but I don't think so. Although it seems like the VB method you're generating for the delegate doesn't actually use a parameter so there's no reason you need to use that delegate for the inner method.
|
|
|
|
|
Doesn't sound like homework to me; I don't know any schools that mix VB/C#, but I do know that managers "insist" on keeping their codebase in a single language
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|