|
The "processor ID" is not really a unique ID. It's a series of capability flags. Therefore, if you have two servers running the same CPU, they'll both return the same ID.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi.
I'm building an application which has to return a value from a database, conditioning on two things.
The database looks like:
|Workplace|
------------------------
ID | Description | Morning | Afternoon | Evening
Description: Description of the workplace
Morning: The hourly wage on this workplace
Afternoon: The hourly wage on this workplace
Evening: The hourly wage on this workplace
Example of a database:
1 | Warehouse | 1,3 | 3 | 3,7
2 | IT | 2,5 | 4 | 5
3 | Maintance | 2 | 2,5 | 7
Ok, we've cleared about the database... now lets got to the program.
In the app. the user must choose When did he work and when. That means, he chooses the ID of the workplace and when did he work.
The app. must then return the value of selected workplace and the wage on the selected time he worked. Thats the problem.
A friend of mine said, that in VB 6 and ADO (not .NET), it was quite simple. You could use the select string and then something with recordset.recordcount and then if recordset field value = ...
I googled and googled and in the end i didnt know what i was googleing The result - found nothing.
Again, im turning too the CodeProject community for help...
Thanks for taking your time to read and i hope you can help
Regards,
Matjaž
Força Barça!
|
|
|
|
|
Its a simple select statement returning (I assume) 1 row with all the columns, from which you select the rate dependant on the time selected by the user. All you need to do is google for "datareader", there are literally thousands of examples. The better alternative is to google for ado.net as again, there are thousands of articles and you will gain a better understanding of datareaders, datasets etc.
BTW,
max00slo wrote: then something with recordset.recordcount and then if recordset field value = ...
sounds like a long way round!
Hope this helps
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Thanks for your answer... eventhough i didnt need datareader with this
The solution to my problem looks like this:
<br />
OleDbConnection dbConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + "C:\\db.mdb");<br />
<br />
string sqlComm = "SELECT * FROM Workplace WHERE ID=2";
OleDbDataAdapter da = new OleDbDataAdapter(sqlComm,dbConn);
DataSet ds = new DataSet();<br />
da.Fill(ds);
<br />
string selected = ds.Tables[0].Rows[0]["DelovnoMesto_PopTarifa"].ToString();
Thanks again
Regards,
Matjaž
|
|
|
|
|
Thats one way, but for performance a datareader is better than filling a dataset - particularly when you are only expecting 1 record.
Also, stored procedures or parameterised queries are preferable (for security and performace reasons - google for sql injection) and it is also bad practice to do select * as you are generally returning more data than you actually require - not significant in this case, but if it was a table with many columns and millions of rows... However, I expect you were just showing sample code and you are aware of this.
Anyway, at least you have got there
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi EveryOne, I have to format string being entered in the TextBox Control, i.e, in the (Lat/Long)format 00 00.000, dynamically as the text is being entered into the textBox,
Please help me out with this issue...
Thanks in Advance...
|
|
|
|
|
I am not sure if I got your question ... while you are pressing keyboard keys on the text box .. you want to add each one in its approperiate place (e.g add 12 34.567 with the format 00 00.000) and validate the possible inputs at the same time ? I can direct you to a living example of such a case is the MaskedTextBox in Windows Forms ...
MaskedTextBox have the ability to have a predefined mask or a custom mask ... where I think will fit your needs ... take a look at it it will help you ... if you are using Web then you can build your customs control and use Regular Expressions with it as well.
Sincerely Samer Abu Rabie
Note: Please remember to rate this post to help others whom reading it.
|
|
|
|
|
Thanks a lot Samer, plz lemme know if any examples of such cases are available....
|
|
|
|
|
Hi,
How can I find out the list of all ASCX files in an ASPX page using regular expressions or any other means quickly?
Thanks
|
|
|
|
|
Hi All,,,
I want To Get the max value of a string from a database,,, such as
I store a value A1-50,A2-50,B1-50,B2-50,,,
I want To Get the max value from these string, but i cann't do that.
Please Help Me.
Thanks All,,,,
|
|
|
|
|
Please do not cross post, its rude.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Follow these steps :
1)- Splite the whole string "," and stored in Array
2)- Create an Array List
3)- Traverse the all items which is stored in step 1 and perform the below opetion
In Loop, again splile with "-" and pick the secod item every time and store in Arrya list which created in step 2
4)- Sort the array list which stored in step 3
5)- Pick the Max value (First index of arraylist)
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
HI,,
please can you help me by the code in c#??/
Thanks,,,
|
|
|
|
|
I have done coding for only max Numeric value..
string temp = "A1-50,A2-50,B1-50,B2-50";
String[] ar=temp.Split(',');
System.Collections.ArrayList arList = new System.Collections.ArrayList();
for (int i = 0; i < ar.Length; i++)
{
arList.Add(ar[i].Split('-')[1]);
}
arList.Sort();
MessageBox.Show(arList[0].ToString());
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
I want todays date in one textbox
and in another textbox 15days incremented
i have a Javascript code for getting date month Year
function addDate()
{
TheDate = new Date();
var theMonth = TheDate.getMonth();
var theDay = TheDate.getDate();
var theYear = TheDate.getFullYear();
if (document.getElementById('Text1').value == '')
{
document.getElementById('Text1').value = theDay + '/' + theMonth
+ '/' + theYear ;
}
else
{
document.getElementById('Text1').value = theDay + '/'
+ theMonth + '/' + theYear ;
}
}
I am unable to increment the date in second textbox
help me to solve this problem.
|
|
|
|
|
kiranreddy wrote: help me to solve this problem
You did not tell us your problem.
Also this suspiciously looks like web stuff and not C#, try the ASP.NET forum.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Use the getTime method to get the date in milliseconds, add the number of milliseconds in 15 days, and create a new Date object from the result.
Note that the month value is zero based, so you have to add one to get the one based value that humans use.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hello everyone,
i have a prop in displaying data from access database. i didn't under stand where i done mistake. i want to edit save data from database.when user enter emp_code and click edit button, then he displa all specific records related to that emp_id.
help me...!!
|
|
|
|
|
u could put some more info on wheres the problem with a sample code and more description...
Força Barça!
|
|
|
|
|
here is my code.....
for delete:-
private void button3_Click(object sender, EventArgs e)
{
conn.Open();
string command1 = "delete from employee where (emp_id = ? AND emp_code = ? AND emp_name = ? AND emp_address = ? AND emp_dob = ? AND emp_doj = ? AND emp_dor = ?)";
OleDbDataAdapter da = new OleDbDataAdapter(command1, conn);
DataSet ds = new DataSet();
da.Fill(ds);
DataTable dt = ds.Tables[0];
conn.Close();
}
for edit:--
private void button2_Click(object sender, EventArgs e)
{
conn.Open();
string sqlcom = "select emp_id,emp_code,emp_name,emp_address,emp_dob,emp_doj,emp_dor from employee where (emp_code=?)";
OleDbDataAdapter da = new OleDbDataAdapter(sqlcom , conn);
DataSet ds = new DataSet();
//ds.Clear();
da.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
int a = Convert.ToInt32(ds.Tables[0].Rows[0]["emp_id"]);
textemp_id.Text = a.ToString();
}
else
{
MessageBox.Show("This E-Code does not exist");
}
conn.Close();
}
i am new in c#..this code is not working..if any change plz modify it.
Thanks
|
|
|
|
|
Hi all,
I have a windows application in client machine.I want to invoke(windows app screen should also be visible)that windows application(client machine) from server machine. Here both client and server machines are in LAN and WAN.
Problem:
1.Invoke the windows application(windows app screen should also be visible in client machine) from server machine.
2.After application opens in client machine,then user enters some data,that data have to be written to a file which is in server machine.
I succeeded to solve the above problem using webservices.
But suddenly I was asked to solve it using .net Remoting.....Iam new to .net remoting.
kindly help me in solving the above problem using .net Remoting.
|
|
|
|
|
Try MSDN, their documentations about .Net Remoting are fine.
Writing in Bold makes no sense. Please don't do that again.
Life is 5: 3 me, 1 you.
modified on Thursday, November 20, 2008 3:02 AM
|
|
|
|
|
And don't crosspost the same questions in multiple forums.
|
|
|
|
|
- Say, you have a running process and you want to know where's the file that initially launched it or..
- You have a locked file "because it is running as a process" and you want to kill its associated process to unlock that file.
Any idea or article dealing with that??
Thanks!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
check the Process class, it can tell you all sorts of useful information.
for example:
foreach (Process p in Process.GetProcesses())
{
try
{
Console.WriteLine(p.MainModule.FileName);
}
catch (Win32Exception ex)
{
Console.WriteLine("caught an exception : " + ex.Message);
}
}
|
|
|
|