|
Hi,
I can open a MSWord document from C# code, but
is it possible to automate a Word document that is
not opened from the C# code ?(i.e. the Word document
is already opened before the c# code run ) If yes, how ?
Thanks
|
|
|
|
|
Hi,
I want to call webservice in the Trigger. How to call the webservice from CLR Triggers?.If anybody knows teh detail let me know.
And i worked out the following Example code for CLR Trigger.
using System.Data;
using System.Collections.Generic;
using System.Text;
using System.Data.Sql;
using System.Data.SqlTypes;
using System.Data.SqlServer;
namespace CLR
{
public class Class1
{
public static void InsertTrigger()
{
SqlTriggerContext sqlTrigger = SqlContext.GetTriggerContext();
SqlPipe sqlPipe = SqlContext.GetPipe();
SqlCommand cmd = SqlContext.GetCommand();
if (sqlTrigger.TriggerAction == TriggerAction.Insert)
{
cmd.CommandText = "Select * from Inserted";
SqlDataRecord dr = cmd.ExecuteRow();
string Subject_uri = dr[0].ToString();
string predicate = dr[1].ToString();
string Obj = dr[2].ToString();
sqlPipe.Execute(cmd);
sqlPipe.Send("You Selected Subject_uri ::"+Subject_uri+" Predicate ::"+predicate+" Object ::"+Obj);
}
}
}
}
After that i created Assembly and Trigger and clr enabled
create assembly CLR from 'C:\Inetpub\wwwroot\Vinoth\CLR\bin\Debug\CLR.dll'
CREATE TRIGGER InsertTrigger
ON Triplets
For Insert
As
External Name
CLR.[CLR.Class1].InsertTrigger
sp_configure 'show advanced options', 1
RECONFIGURE
sp_configure 'clr enabled', 1
RECONFIGURE
insert into Triplets values('test','_2','Testing1')
When i insert the values it is inserting into table .But why ican't get sqlpipe.send Message.
How do i know whether my CLR trigger is working?
Thanks,
Vinoth
|
|
|
|
|
hi there
I would like to have my windows service, which normally run under LocalSystem account to access a network share from where I need to copy to text files and later delete these to files.
I have tried to change the account under which the service run to NetworkService and this has not helped. Does anyone know how to solve this problem ?
|
|
|
|
|
You can't use the NetworkService account and expect this to work. Create a normal user account with the rights that it needs and run the service under that account.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I want to draw string, but in specific way... I got a curved line, for example sinusoid, and i want to draw text on it exactly... How to do it?
|
|
|
|
|
First, create a System.Drawing.Graphics object.
Then draw your curve onto it using Graphics.DrawCurve() method, or if your curve is an image, use the Graphics.DrawImage() method.
After that, use the Graphics.DrawString() method to write the text you want onto the curve.
> whoami
The system is unable to identify you when you don't even know your name!
|
|
|
|
|
You didn't understand me... i want my text be curved on line...
|
|
|
|
|
you did not understood him... thats what he is trying to teach you ... better rephrase your question if you have a point...
its me =Þ
grim zax
|
|
|
|
|
Ok, let me explaine....
For example if i got horizontal line, i draw the text horizontally on it...
If i got a vertical line, i draw the text vertically...
If i got curved line, i draw each letter exactly on line... So if i got sin function and word "Hello World!", i need the 'H' at the start, 'e', next step on line... and so on... Let words dancing on line....
|
|
|
|
|
Please anyone help me i still new in this C# development.
I'm trying to have two classes e.g Customer, Account classes and the Account class must inherit the Customer class, but i don't know where to start.
please help
|
|
|
|
|
sosodev wrote:
but i don't know where to start
The best place to start is down at your local bookshop. Look for a book aimed at beginners, and not one aimed at teaching a programmer a new language. Go through tthe book writing out the examples and building on them as necessary. This will help you to understand the underlying principles of programming.
|
|
|
|
|
|
hi there,
try with this: public class Account: Customer
u can follow the walkthrough in MSDN to get familiar with C#
<< >>
|
|
|
|
|
|
Hi,
Can u tell me to make one set up exe for both the project Currently i have made two installer one for WIndows Service and another for my project. I can install the project set up and after that i am able to install Windows Service(This is user defined service)
My client wants to integrate into one set up exe
can anybody help me
Thanks
|
|
|
|
|
Hi,
I have made set up for user defined Windows Service and tested with Window2000 It working fine
but when i install the windows service in Windows XP, i get error while running the windows service
can any one tell me is there an\y difference in making Windows service in Win2k and Win XP I am making WIndows service (User defiend) in c#
regards,
Sanjeev
|
|
|
|
|
There are differences in what's supported, but it's usually what 2000 doesn't support that XP does.
Since you didn't mention what the error was, of what your coding is doing when the error occurs, it's impossible to tell you anything useful.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi
I have installed dotnetframework in Win XP and Win2k
when i run Windows Service and click on desktop of my product
its showing me the following error
Commn Language Runtime Debugging Services
Process id=0xb50(2896),Thread id=0xb54(2900)
click OK to terminate the application
Click CANCEL to debug the application
What should i write in my Windows Services(User defined service) so that it should not
show the above error
When i run my product exe from the desktop and after that i run my windows services it
shows that only one instance of application is allowed at a time
This program should identify if any man.exe exist it should stop that instance and start
another instance of man.exe but this program as a windows service does not work
protected override void OnStart(string[] args)
{
// TODO: Add code here to start your service.
Process[] aProcesses1;
if (aProcesses1.Length > 0)
{
if(rd1==true)
{
// The last excel process is the orphaned process which is killed
aProcesses1[aProcesses1.Length-1].Kill();
rd1=false;
}
}
int intExcelPID;
aProcesses1=Process.GetProcessesByName("man");
string strProc="These are the processes running \n";
for (int i = 0; i <= aProcesses1.GetUpperBound(0); i++)
{
intExcelPID = aProcesses1[i].Id;
strProc+=intExcelPID.ToString()+ " ";
}
//Retrive from registry the value of Path
RegistryKey hklm =Registry.LocalMachine;
hklm=hklm.OpenSubKey("SOFTWARE\\man");
Object obp=hklm.GetValue("Path");
string file=obp.ToString() + "\\man.exe";
Process.Start(@file);
}
When i write the above program it does not work even it does not start when i start my
computer
Regards
sanjeev
|
|
|
|
|
Wow. Where to begin...
First, you've put this in the the OnStart procedure of your service. This means that it will only run ONCE per start of the service or on startup of Windows. OnStart is meant for you to start your service code, possibly on another thread. The way you have it setup, your code will execute once, then stop.
The error comes up because you have a problem with your code in the OnStart() method. You've got ALOT of problems with this code.
protected override void OnStart(string[] args)
{
Process[] aProcesses1;
if (aProcesses1.Length > 0)
{
if(rd1==true)
{
aProcesses1[aProcesses1.Length-1].Kill();
rd1=false;
}
}
int intExcelPID;
aProcesses1=Process.GetProcessesByName("man");
string strProc="These are the processes running \n";
for (int i = 0; i <= aProcesses1.GetUpperBound(0); i++)
{
intExcelPID = aProcesses1[i].Id;
strProc+=intExcelPID.ToString()+ " ";
}
RegistryKey hklm=Registry.LocalMachine;
hklm=hklm.OpenSubKey("SOFTWARE\\man");
Object obp=hklm.GetValue("Path");
string file=obp.ToString() + "\\man.exe";
Process.Start(@file);
}
But first, I take it your trying to find Excel processes that are left open by an application? Why?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all, I am new in C#.
I have two classes, class A and class B. Class B is inherited from class A.
When I create an object of class B, will an object of class A also be created?
In addition, if class A has a member "public string myName", after I create an object of class B, the created instance also can access myName, but what does the statement " base.myName = "HELLO" " mean? I know it assign "myName" of the base class (class A) with "HELLO", but why do we assign member of the base class if no instance of the base class created?
Regards,
Tommy
|
|
|
|
|
When you create an instance of a derived class, an instance of the base class (usually embedded in the instance of the derived class) is automatically created for you. That answers your second question as well, there is an instance of the base class.
You can usually get away without using the base prefix, as public and protected members of the base class are accessible from the derived class directly. Usually, the base prefix is used to call the base class implementation from within overridden functions and to disambiguate functions and member variables.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thanks for your answer~~~
I have some more questions.
1) When a member in the base class (class A) is declared as private (say "private int x"), will the instance of the derived class (class B) has a that private member? Is that an inherited class always inherits all members of the base class but cannot access the private members? (For example, in this case, class B also has "private int x", but cannot access "x" )?
2) When a method in the base class (class A) is overridden by the derived class (class B), is that the overridden version of the method be always called?
For example,
class A
{
public virtual void Test()
{
Console.WriteLine("This is A");
}
}
class B : A
{
public virtual void Test()
{
Console.WriteLine("This is B");
}
}
static void Main()
{
B b = new B(); A a = b;
b.Test();
a.Test();
}
The above code sample is copied from a book, but I am confused.....
I know the statement "b.Test()" will cause the output "This is B"
but how about "a.Test()", as a is referenced to the object of type B, which version of the method will be called?
What is meant by "A a = b"?
Again, thanks a lot for your help!!
Regards,
Tommy
|
|
|
|
|
Hi, I'm trying to find out where the root path (ie. the physical folder of "http://mydomain.com/") is programmatically, but I'm not sure how to do this. After researching a bit, I came up with the following information:-
- In Wise Installer and Install Shield they check for the registry value under
HKLM\Software\Microsoft\InetStp\PathWWWRoot , but this only points to the default folder at installation, not the current (possibly moved) folder location. - In Windows XP, I'm able to find the correct location under
HKLM\System\CurrentControlSet\Services\W3SVC\Parameters\Virtual Roots , but this key does not exist in Windows 2003 Server operating system. In fact, on Windows 2003, I can't find the correct location anywhere in Registry! Is there a way to locate the right folder independent of any machine? - I know that in .NET it is possible to use
System.DirectoryServices.DirectoryEntry("IIS://mydomain.com/W3SVC") to locate the correct path, but I'm trying to find an easier way to do this - by using only files and registry. Using DirectoryEntry to query the IIS service may also result in a permission denied problem.
What I'm trying to do is to build a setup package in Install Shield to deploy a web-application. Since Install Shield can't locate the IIS root path correctly, I have to manually set the path myself. The capability of the Install-Script that comes with Install-Shield is limited, therefore I cannot use the third option above.
So can anyone shed a light here? Thanks in advance!
> whoami
The system is unable to identify you when you don't even know your name!
|
|
|
|
|
I would have the person manually set the path for your app, as they may have their server set up where the server has the files on a remote computer.
|
|
|
|
|
I am lookinf for a way to insert data into Field codes in Ms Word from C#, I have been able to get it to open up the template and insert the data but i cant find anyway to insert it at the point where the codes are (it just places the text at the top)
Anybody know of a way to reference the Fields?
Cheers
|
|
|
|