|
how can i keep track of the user in the application while he is logged on ,something like session in web appl..
|
|
|
|
|
you can use static variable
|
|
|
|
|
u can try following codes
u can find process object in System.Diagnostics namespace
int pcnt =0;
Process curproc = null;
Process[] pr = Process.GetProcesses("ur machine name");
foreach(Process pr2 in pr)
{
if(pr2.ProcessName.Equals("ur application name"))
{
pcnt=pcnt+1;
curproc = pr2;
}
}
if(pcnt>1)
{
MessageBox.Show("Application already running");
curproc.Kill();
}
rahul
|
|
|
|
|
thanks rahul..
could you please explain me what is happening behind these code , it would help me a lot to arrenge this solution as my request..
thanks again...
|
|
|
|
|
first I'm Korean.
I can't speak Englisg well... Sorry~
now i'm using C#(2005).
I wanna know how to get FTP Server's directory name.
Of Course I alread have FTP Server.
I don't know, what kind of class I have to use.... please help me~
If it possible, I need some example source.
Have a nice day~~~
|
|
|
|
|
|
Hi,
Can someone please tell me the methods to check the checkedlistbox based on my sql querie?
I have this sql code.
string sql = "Select e.TechnicalSkillsID from employees e where EmployeeID = '" + FirstnameText.Text.ToString() + "' and EmployeeID = '" + Lastnametext.Text.ToString() + "'";
My c# code - techSkillsCheckListBox2.GetItemText(adoDR["TechnicalSkillsID"].ToString());
another sql statement
sql = "Select t.ProgLanguagesDatabase from TechnicalSkills t, employees e where e.TechnicalSkillsID = t.TechnicalSkillsID";
and then finally a for loop which should check the boxes based on techskillsID but nothing happens.
for (int i = 0; i < techSkillsCheckListBox2.Items.Count; i++)
{
if (adoDR["TechnicalSkillsID"])
{
if (techSkillsCheckListBox2.Items.Equals(adoDR["TechnicalSkillsID"].ToString()))
I think all that is wrong is the 'if' statement because the debigger picks up the correct value.
My manager can't even work it out and apparently they think I am the one not progressing. 
|
|
|
|
|
Does the query return multiple TechnicalSkills for each employee?
In that case, are you also iterating over the various instances of TechnicalSkills per user?
(you're not as of what you've showed us so far).
Or are you showing only one user at a time?
The query should return a table consisting of rows equal to the amount of technical skills for that user, unless you store all the skill ids in one column with a seperator.
falles01 wrote: if (adoDR["TechnicalSkillsID"])
What's this line supposed to check for?
falles01 wrote: if (techSkillsCheckListBox2.Items.Equals(adoDR["TechnicalSkillsID"].ToString()))
And this if statement compares a Collection of CheckedListBoxItems with a string.
-Larantz-
|
|
|
|
|
well I actually do need multiple entries /skills in the database yes but I am not sure how to do that part either. I have created a new table and have employeeID and TechnicalSkillsID bu thats as far as I've gotten. I haven't written any code for it. Can you help in that department at all? The skills will be saved to the database by checking checkedlistboxes. I am also using dataadapters. Once I've gotten that part right, will it fix the problem of automatically checking the checkedlist box for a given employees skills?
Thank you
|
|
|
|
|
First of all you should decide whether you want the TechnicalSkillsID as a column in the employees table - as you have now. If you keep it that way, and you want one empolyee to be able to own several TechnicalSkills, you'll have to store several ID's with a separating value.
A better approach, if you ask me, would be to remove the TechnicalSkillsID column from the employee table entirely, and rather create a TechnicalSkills table which uses the employeeID as a keyvalue. Then add one boolean column per technical skill that you want available.
You could then use the column name as a the name of the CheckedListBoxItem and set the Checked property according to the value from the database.
I'll write an example of the latter one:
Create a query for retrieving the row from the TechnicalSkill table with a employeeID equal to the employee you want to configure skills for.
Code for propagating and setting the value for CheckedListBoxItems:
... generate and execute the query for returning the techskills for the given employee
DataTable techSkillsTable = myDataSet.Tables[0];
foreach(DataRow row in techSkillsTable.Rows)
{
foreach (DataColumn column in techSkillsTable.Columns)
{
string techSkillName = column.ColumnName;
bool userHasSkill = false;
try
{
userHasSkill = Convert.ToBoolean(row[column]);
}
catch
{
}
techSkillsListBox.Items.Add(techSkillName, userHasSkill);
}
}
Hope it can be of some help.
Best regards!
-Larantz-
|
|
|
|
|
Good evening everyone,
Just migrated from Oracle8 to Oracle9i and have a problem while running this line now "which I didnt have in Oracle8!!"..
OracleConnection ConnectMe = new OracleConnection("Data Source=orcl; Persist Security Info=True;User ID=DLDSP; Password=DLDSP;Unicode=True");
ConnectMe.Open();
It says: OCI.Dll, The specified module could not be found (twice) and then it breaks down and gives me:
OCIEnvCreate failed with return code -1 but error message text was not available.
Many thanks guys
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
You could always do a select before you do the insert, but this is no guarantee that the data isn't being inserted by another user at the same time. Take a look at phantom data to see what I mean.
Alternatively, you could put a unique index on the field and let that take care of it. This isn't a nice option because it would result in an exception being thrown which you would need to deal with.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O`Hanlon wrote: You could always do a select before you do the insert, but this is no guarantee that the data isn't being inserted by another user at the same time.
He could also create a datalayer for database communication and let all modifications go through there with a lock to avoid simultaneous insertions.
-Larantz-
|
|
|
|
|
The problem is that a datalayer doesn't always guarantee that this happens. It really depends on the architecture, but suppose that the datalayer was consumed by web services, then there is no guarantee that this situation would not still occur.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hey
Ok first a confession I have got a bit Giddy with GDI so like using it for lots of things as it is simple but effective. However last year I made a small image manipulation application in Borland C++. I would like to over the following months build quite a complex one using C#.
Now I know there is a picture box control but I would also like to allow the user to draw things such as simple 2D and 3D shapes etc - my question is this:
Is the picture box control flexible enough for this or would I be better making my own control (say a white background and then drawing on it as the user wishes using GDI) or is there a better built in control?
Thanks
Dan
**Edit - basically what I would like to be able to do is ask any pixel inside a control its colour and also to set its colour
-- modified at 16:15 Thursday 6th September, 2007
|
|
|
|
|
No,the picture box control is useless, handle your own paint event and draw your own image.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
DanB1983 wrote: **Edit - basically what I would like to be able to do is ask any pixel inside a control its colour and also to set its colour
Basically, you need to read my image processing articles to learn how to most efficiently do that, or you need to use the GetPixel method on the image class.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
Hi,
I have a sqlserver database table Students with 4colummns: [studentid], [studentname], [studentaddress], [studenttel].
i want to read all the records from this table, make textboxes and put the data into these textboxes.
can somebody help pls?
Djavid j
|
|
|
|
|
You mean to use textboxes set to multiline with all studentids in one textbox?
Or one textbox per value which would result in 4 textboxes multiplied with the amount of rows in your table.
Anyhow - you should use a SQL adapter to retrieve the dataset, and then iterate over the rows in the table to read the values and fill them into your textboxes.
-Larantz-
|
|
|
|
|
Unless you know for a fact that the amount of rows in the table will be of a managable size, you might end up with hundreds of textboxes. (4 textboxes multiplied with the amount of rows).
You can get the amount of rows through the DataSet.Tables[<table index here>].Rows.Count property.
You'd be better off showing the data through either 4 textboxes set to multiline, or even better 4 ListViews, or the best alternative being a DataGridView.
To loop through the rows and retrieve data you could do the following:
... in the method where you process your dataset data ...
DataTable table = yourDataSet.Tables[int tableindex];
int rowCounter = 0;
foreach(DataRow row in table.Rows)
{
foreach(DataColumn column in table.Columns)
{
TextBox textBox = CreateValueTextbox(
column.ColumnName + rowCounter,
row[column.ColumnName]);
this.Controls.Add(textBox);
rowCounter++;
}
}
...
private TextBox CreateValueTextbox(string textBoxName, string value)
{
TextBox textBox = new TextBox();
textBox.Name = textBoxName;
textBox.Text = value;
return textBox;
}
NB!
I haven't compiled this so I might have missed something
Hope some of it can be of help.
Best of luck!
-Larantz-
-- modified at 18:19 Thursday 6th September, 2007
Btw - there's no handling of the location of the textboxes, so you'd have to add that yourself.
As of now they'll be placed on top of eachother.
modified on Wednesday, January 16, 2008 10:20:29 AM
|
|
|
|
|
Larantz thanx it was great help
|
|
|
|
|
more of an ADO.NET question[^] you can draw the text boxes dynamically (not that hard if you have problems see: here[^] will show how to create buttons then you can change the controls to anything else)
|
|
|
|
|
I was create many web controls with LoadControl() and I put these inside panel when Page_Load(),
each control have UpdatePanel for change the content of that control,
but when the event generated by UpdatePanel occurs, the Control dont exists.
Any idea, thanks.
Pandacad, a beginer in programing world 
|
|
|
|
|
Odd question, I know. But I cannot find help with this anywhere. I need, upon right click of a datagrid, to be able to have a context menu pop up (which I know how to do) but within this context menu I want to include the Word Filter, then right next to that have a textbox which one can enter text into for filtering.
If you need an example, Microsoft Access uses this function. I have searched high and low for a solution to this and *any* suggestions or samples would be wonderful.
Thanks!
Aaron
|
|
|
|