|
Hi
Thanks a lot. I have got the solution. I used a static variable and did it.
Can i have your personal id? This is incase of future help?
|
|
|
|
|
I dont know how helpful I could be (I can try but I think there are many more bright people here on cp!) but you are welcome to contact me via email if you need help with something - gavirj2002 at yahoo.co.uk
|
|
|
|
|
hi!
How could i implement delay in c#? that will logicallylook like this:
while<br />
{<br />
process1();<br />
delay(5);<br />
}
thanks!!!
|
|
|
|
|
Use the Thread.Sleep() method.
Regards
Senthil
|
|
|
|
|
Thanks Senthil!!!
|
|
|
|
|
wanna explore this
any sample code for this topic.....
thanx in advance
|
|
|
|
|
Hi ronin,
You can access the database from the webservice in the same way you access from the other applications. The following lines of code connect to the database and return the results in the form of a dataset.
[WebMethod]
public DataSet GetData()
{
SqlConnection conn = new SqlConnection();
string connstring = "Persist Security Info=false; Integrated Security =false; database=DATABASENAME; server=DATABASESERVERNAME; User ID=USERID; Password=PASSWORD";
conn.ConnectionString = connstring;
DataSet ds = new DataSet("Employee Data Set");
SqlDataAdapter adptr = new SqlDataAdapter("select * from TABLE NAME", connstring);
adptr.Fill(ds);
return ds;
}
Hope this will help you.
Regards
SGS
|
|
|
|
|
The above reply seems to be fine I would like to add some details. Please do take care connection string settings and securtiy
Padvit
|
|
|
|
|
i have created a server and client application.
i have ran the server but after a few days of running, it seems to utilize almost 100% of the processor, is this a problem of memory allocation (memory leaks)? if so, what should i do to address this problem? what are the tools which can be used to check if there exists any memory leaks?
|
|
|
|
|
100% utilitization of the processor probably means that there are a lot of threads running around. If you're looking to measure memory consumption, look for Memory Usage and related columns in Task Manager.
Regards
Senthil
|
|
|
|
|
threads seems like a valid reason for 100% cpu
@topic
maybe it's not even the memory itself that's leaking but the thread-resources...
make sure every thread is properly killed (thread.Abort()) after it's done (on WinAPI it really is necessary to do this every time, not sure if the GC collects finished threads so just make sure it's cleaned up)
since you have a client-server-model I guess you're using threads and "sessions" for each user. make sure every session has an inactivity-timeout and it's properly cleaned up (all the threads, all the resources)
so long.
|
|
|
|
|
My application allows user to authenticate to a remote share using domain loggon by invoking mpr.dll
[DllImport("mpr", CharSet=CharSet.Auto)]<br />
public static extern int WNetAddConnection2(<br />
ref NETRESOURCE lpNetResource,<br />
[MarshalAs(UnmanagedType.LPTStr)]<br />
string lpPassword,<br />
[MarshalAs(UnmanagedType.LPTStr)]<br />
string lpUserName,<br />
int dwFlags<br />
);
For example I logged on using following user name: "DOMAIN_1/USERNAME_1".
I would like to find out the user groups (Administrators/Users/etc. ) of user USERNAME_1 within DOMAIN_1.
Could anyone please suggest how to do that?
I have tried using NetUserGetLocalGroups() (netapi32.dll) function but it only retrieved the user groups of USERNAME_1 in the local machine, not in the domain DOMAIN_1. I've tried NetUserGetGroups() too but don't know how to set the parameters to get it right. Please help.
[DllImport("netapi32", CharSet=CharSet.Auto)]<br />
public static extern int NetApiBufferFree(<br />
out IntPtr bufptr <br />
);<br />
<br />
[DllImport("netapi32", CharSet=CharSet.Auto)]<br />
public static extern int NetUserGetLocalGroups(<br />
[MarshalAs(UnmanagedType.LPWStr)]<br />
string servername,<br />
[MarshalAs(UnmanagedType.LPWStr)]<br />
string username,<br />
int level,<br />
int flags,<br />
out IntPtr bufptr,<br />
int prefmaxlen,<br />
out int entriesread,<br />
out int totalentries<br />
);<br />
<br />
<br />
public static ArrayList GetUserGroups(string serverAddress, string userName)
{<br />
<br />
ArrayList groupNames = new ArrayList();<br />
int entriesRead = 0;<br />
int totalEntries = 0;<br />
<br />
IntPtr bufPtr;<br />
<br />
int errorInfo = NetUserGetLocalGroups(serverAddress,userName,0,LG_INCLUDE_INDIRECT,<br />
out bufPtr,MAX_PREFERRED_LENGTH,out entriesRead,out totalEntries);<br />
<br />
<br />
<br />
if(entriesRead> 0)<br />
{<br />
LOCALGROUP_USERS_INFO_0[] RetGroups = new LOCALGROUP_USERS_INFO_0[entriesRead];<br />
IntPtr iter = bufPtr;<br />
for(int i=0; i < entriesRead; i++)<br />
{<br />
RetGroups[i] = (LOCALGROUP_USERS_INFO_0)Marshal.PtrToStructure(iter, typeof(LOCALGROUP_USERS_INFO_0)); <br />
iter = (IntPtr)((int)iter + Marshal.SizeOf(typeof(LOCALGROUP_USERS_INFO_0)));<br />
groupNames.Add(RetGroups[i].groupname);<br />
}<br />
int error = NetApiBufferFree(out bufPtr);<br />
}<br />
<br />
if (errorInfo != NERR_Success)<br />
{ <br />
int error = NetApiBufferFree(out bufPtr); <br />
}<br />
<br />
return groupNames;<br />
}
|
|
|
|
|
|
Look at the System.Management namespace. ManagementObjectSearcher will allow you to query active directory for the info on the domain account. I don't have any code on this computer to offer. You can probably find the query you need by googling on 'wmi user groups' or something.
|
|
|
|
|
Hi Friends,
I have a datagrid (in C#) where in all the rows in a particular cell has hyperlink attribute.
But on ItemDataBound event I want to remove Hypelink attribute from some of the Rows in that particular cell (Conditionally).
My following logic does not seem 2 work
Private dg_ItemDataBound.....
{
e.Item.Cells[1].Attributes.Remove("href");
}
How do I remove hyperlink in some rows in Datagrid??
Regards,
Vipul Mehta
Regards,
Vipul Mehta
Software Engineer
Chenoa Information & Software Services Pvt Ltd
|
|
|
|
|
Hi Friends,
I have a datagrid (in C#) where in all the rows in a particular cell has hyperlink attribute.
But on ItemDataBound event I want to remove Hypelink attribute from some of the Rows in that particular cell (Conditionally).
My following logic does not seem 2 work
Private dg_ItemDataBound.....
{
e.Item.Cells[1].Attributes.Remove("href");
}
How do I remove hyperlink in some rows in Datagrid??
Regards,
Vipul Mehta
Software Engineer
Chenoa Information & Software Services Pvt Ltd
|
|
|
|
|
I coded some kind of electronical Post-it notes and I want to stick them on the Windows Desktop, but how?
The Show Desktop Icon (or Winkey+D) always minimizes my form and i couldn't find any way to prevent that.
Another Idea would be to directly draw my stuff on the Desktop but I don't know how to register to the OnPaint event of the desktop to redraw my stuff.
Thanks a lot in advance.
|
|
|
|
|
>The Show Desktop Icon (or Winkey+D) always minimizes my form and i couldn't find any way to prevent that.
I discoverd that when I click "Show Desktop" that I get the Mesage WM_ACTIVATEAPP which tells me that my app gets deactivated and a thread from the explorer.exe Process gets activated.
So far so good, but how do I prevent now that my app gets minimized?
|
|
|
|
|
hi, anybody has some sample code about how to return a value from a thread, lets say I have a couple of threads running, and I want to return the value of a calculation that its done in the thread, how can achieve this
thanks in advance
|
|
|
|
|
I believe threads must remain void. If you are certain that you won't interfere with variables, just set your calculated value in a class variable within the thread. If you aren't certain you have exclusive access to that variable, then put a lock on it.
|
|
|
|
|
The ThreadStart delegate returns void, so you can't return anything. Look for the BeginInvoke/EndInvoke methods, they allow you to return a value. Or you can use a shared variable to do the job.
Regards
Senthil
|
|
|
|
|
Hi everyone, i need to ask about reading true color image in C#. Thank you
|
|
|
|
|
Read the MSDN. Search on google. The bit depth is irrelevant, C# can read them all.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I’m successfully using SystemTimeToTzSpecificLocalTime to continuously update the local time in a specified time zone. Successfully, that is, until I open another form (using the showdialog method). Once the showdialog method is invoked, the SystemTimeToTzSpecificLocalTime fails continuously --- even after the second form is closed. Same results using the show method. Any ideas?
BTW, this is on Windows XP using Visual C# Express (Beta 1).
Thanks.
|
|
|
|
|
Continuing the thread started here
http://www.codeproject.com/script/comments/forums.asp?forumid=1649&fr=26&select=1039197#xx1039197xx
i would understand something more about windows shell integration.
I've serched on codeproject, on msdn and on google, but i haven't got no good information about.
Can someone show me some good tutorial or explaination?
|
|
|
|