|
sunilwise wrote: string sql = "select CONVERT(varchar ,[dateregistered],103) Dates,[user],[client facility],sum([payroll score])LC from [sheet1$] group by [user],[client facility], CONVERT(varchar ,[dateregistered],103) order by [user]";
no probs i got the solution i modified my query to
string sql = "select format([dateregistered],'MM/dd/yyyy') as Dates,[user],[client facility],sum([payroll score]) as LC from [sheet1$] group by [user],[client facility], format([dateregistered],'MM/dd/yyyy') order by [user]";
its working gr8 for me
|
|
|
|
|
Hi
I am creating windows service for finding the job information using WMI.Service is installed successfully.
I can start service successfully, but, when I give command to print some document. The document get s printed but that time, it does not track any job status. I am not getting printer job using ManagementObjectCollection printJobs = printJobsSeacher.Get();.
I want to know how can I Get printer job staus when I use window service.I think , I am doing some mistak .Plese help me.
public partial class WMIPrinterService : ServiceBase
{
static Timer oTimer;
public const int iInterval = 200;
public WMIPrinterService()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
oTimer = new Timer(new TimerCallback(Callback), this, 0, iInterval);
}
public void Callback(object sender)
{
GetStatus();
}
protected override void OnStop() { }
void GetStatus()
{
ManagementObjectSearcher printJobsSeacher = new ManagementObjectSearcher(@"SELECT * FROM Win32_PrintJob");
ManagementObjectCollection printJobs = printJobsSeacher.Get();
foreach (ManagementObject item in printJobs)
{
// Print JobStatus
}
}
}
Regards
Rajesh
rajesh
|
|
|
|
|
Rajesh_K_Sharma wrote: void GetStatus()
{
ManagementObjectSearcher printJobsSeacher = new ManagementObjectSearcher(@"SELECT * FROM Win32_PrintJob");
ManagementObjectCollection printJobs = printJobsSeacher.Get();
foreach (ManagementObject item in printJobs)
{
// Print JobStatus
}
}
}
if your run this code with out services does this get the print job status?
try this
<br />
using System;<br />
using System.Management;<br />
using System.Windows.Forms;<br />
<br />
namespace WMISample<br />
{<br />
public class MyWMIQuery<br />
{<br />
public static void Main()<br />
{<br />
try<br />
{<br />
ManagementObjectSearcher searcher = <br />
new ManagementObjectSearcher("root\\CIMV2", <br />
"SELECT * FROM Win32_PrintJob"); <br />
<br />
foreach (ManagementObject queryObj in searcher.Get())<br />
{<br />
Console.WriteLine("-----------------------------------");<br />
Console.WriteLine("Win32_PrintJob instance");<br />
Console.WriteLine("-----------------------------------");<br />
Console.WriteLine("JobStatus: {0}", queryObj["JobStatus"]);<br />
}<br />
}<br />
catch (ManagementException e)<br />
{<br />
MessageBox.Show("An error occurred while querying for WMI data: " + e.Message);<br />
}<br />
}<br />
}<br />
}<br />
cheers,
Abhijit
|
|
|
|
|
Hi Abhijit
Thanks,
I would like to implement in windows service not in console application . I already did in console and window form application.It works fine . But when I use in windows service . It don't work.
rajesh
|
|
|
|
|
hi friend i want to get the list of the database server on local computer or network using C# code can any body tell me how i can get that list of the server's
wasim khan
|
|
|
|
|
|
|
Thanx Jimmanuel its realy help me
wasim khan
|
|
|
|
|
im trying to write to hklm so i can set my app to start up with windows, however, vista refuses access to hklm, any way to elevate the program access rights?
|
|
|
|
|
You need to include a manifest in your app to tell vista that it requires elevation.
Alternatively, there are API methods you can call to only elevate briefly while you perform the action. You should still include a manifest though, because it's in the manifest you tell vista your app is aware of UAC and how vista should behave.
Simon
|
|
|
|
|
if you want to run a program with admin rights after login you can make a scheduled task.
I did it for remove c$ and admin$.
|
|
|
|
|
You can disable the administrative shares properly if you want.
http://en.wikipedia.org/wiki/Administrative_share#How_to_disable[^]
It's not really necessary though. They are only accessibly locally on the domain and you have to have local admin access on the PC to view them. If someone has local admin access, they could just log in and create any shares they wanted anyway. It isn't a security hole to all your files. We use them quite a bit, it's handy to get to log files and stuff without having to go to the PC, or remote in, or create a proper share.
Simon
|
|
|
|
|
good article thanks, but there is no in VISTA
Hive: HKEY_LOCAL_MACHINE
Key: SYSTEM\CurrentControlSet\Services\LanManServer\Parameters
Name: AutoShareWks
where is AutoShareWks?
modified on Friday, July 18, 2008 8:49 AM
|
|
|
|
|
You have to create it. (it's a DWORD type key)
Simon
|
|
|
|
|
Hey Guys,
I am a newbie to .NET and I need help with databinding a dropdown control at the backend(aspx.cs) file, also there is second part to it which is, based on the selection on the dropdown, the data on the grid view control needs to filtered. Sorry about the long description, please help!!!!!!
Thanks in advance.
Sam
|
|
|
|
|
Hi,
I my opinion i think you should make all your filters and sorts in SQL Store Procedures.
After that, trigger the SP´s in some kind of events; like the Button_Click or DropDown_SelectIndexChanged as in your case!!!
I assume that you are ok on making SP´s.
I don´t filter or sort data in C# but it is possible, my way works just fine!!!
Do it and if you became stuck ask here again
|
|
|
|
|
Thanks for the suggestion (sorry don't know your name). But I did it through C# code as follow:
ddlStatus.DataTextField = "Value";
ddlStatus.DataValueField = "key";
ddlStatus.DataSource = StatusList;
ddlStatus.DataBind();
I didn't have the datafields before since we are using the repository system here also I am new to using controllers and repository system. But thanks a lot for your reply. Catch up the next time!
S
|
|
|
|
|
I am porting a VB6 winsock.ocx based library to a .Net Sockets implementation, and I am not the most savvy sockets programmer. The architecture of the communication system was designed long before I got here; so changing the overall design is not an option. Moreover, this system has a low frequency of tcp traffic, so the Socket.Connected will almost always be out-of-date.
The fundamental issue is the connected property of the socket. It does not seem to be funcitonal; however, I have found others that have had similar issues http://msdn.microsoft.com/en-us/library/system.net.sockets.socket.connected.aspx[^]
When I stepping-through the code in the debugger, unplug the network at the right moment, and view the sock object with the quick watcher, it shows me the value of sock.Connected has changed to false as expected. However, while running the code below, in debug mode but not stepping-through, the behavior of sock.Connected is different (when I unplug the wire, it does not update to false).
Thoughts?
private bool isConnected(){
bool rVal = false;
try
{
bool blcking = sock.Blocking;
try
{
byte[] junk = new byte[2];
sock.Blocking = false;
sock.Send(junk, 1, 0, SocketFlags.None);
rVal = sock.Connected;
}
finally
{
sock.Blocking = blcking;
}
}
catch (SocketException e)
{
rVal = e.SocketErrorCode == SocketError.WouldBlock;
}
return rVal;
}
You can only be young once. But you can always be immature.
- Dave Barry
|
|
|
|
|
Hi,
I don´t know that i think, but do you know about Asynchronous connections? If not read about it!
Maybe because you are not using that your sockets blocks.
Check out the way you managed your threads maybe because you are invoking a wrong thread!
Sorry i can´t help you more!
|
|
|
|
|
Well - Thanks for your input anyways
You can only be young once. But you can always be immature.
- Dave Barry
|
|
|
|
|
Hello,
I'm having difficulty signing a string using the RSA cryptography algorithm.
I've search here in this forum for sample code, but I guess, signing is not that popular.
Anyway, any help would be greatly appreciated.
here is my code.
public static string SignMyData(string data2Sign)
{
AssignPr();
byte[] byte2Sign = System.Text.Encoding.UTF8.GetBytes(data2Sign);
StreamReader reader = new StreamReader(@"C:\MyPrivateKey.xml");
string pubPriKeyXML = reader.ReadToEnd();
rsa.FromXmlString(pubPriKeyXML);
reader.Close();
byte[] byteSig = rsa.SignData(byte2Sign, "SHA1");
return System.Text.Encoding.UTF8.GetString(ByteSig);
}
If anyone knows of a simple tutorial or can guide me through this, that would be great
Thanks
JC
|
|
|
|
|
nyjcr wrote: rsa.FromXmlString(pubPriKeyXML);
'rsa' seems to be a non-static member variable. You cannot use non-static member variables in static methods. Try changing your method to a non-static one.
|
|
|
|
|
|
|
Hi,
Can anyone help me here to translate this? It´s from a help file that is only coded in vb.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
CType(objForm, Form1).Label2.Text = TextBox1.Text
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyForm As New Form2()
MyForm.objForm = Me
MyForm.SetBounds(400, 400, 300, 300)
MyForm.Show()
End Sub
Public Property Form2Value() As String
Get
Return MyVal
End Get
Set(ByVal Value As String)
MyVal = Value
End Set
End Property
Thanks
|
|
|
|