|
I using System.Collections.HashTable to keep some information about my database.
The information that i collect in my HashTable is -
1. string ( as the key )
2. other string ( as the value )
my problem is that i want to scan the HashTable and when the value string is equal to some parameter i want to stop my scan and check the string key value.
How can i do it ?
Thanks for the help.
|
|
|
|
|
By iterating over the Keys collection.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
You can iterate the keys collection, and then retrieve and check the value for each key, reacting when you find your sought after value.
|
|
|
|
|
Hi friends........I've created a database application using C# and MS-Access........& the database part is working fine.........now is it possible to print the report directly to a PDF file from an Access database instead of using Crystal Report..........pls reply back asap..........THANKS
Thanks
|
|
|
|
|
Yes, you can buy a PDF library and use it to generate PDFs
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi All,
I have timespan object:
TimeSpan ts= new TimeSpan(0, 72, 1);
when i say :
MessageBox.Show(ts.ToString());
then i get: 01:12:02
What is that means?? 1 days, 12 hours and 2 minutes???
Thanx.
|
|
|
|
|
You're using this constructor:
public TimeSpan(int hours, int minutes, int seconds);
so you've created a timespan object for 72 minutes and 1 second.
which just happens to be exactly 1 hour, 12 minutes and 1 second.
(I'm assuming you've mistyped your output. it's 1 second, not 2)
KamarBand wrote: then i get: 01:12:02
Simon
|
|
|
|
|
Can Anyone Help
How to Remove the Duplicate Key(Repeated data) in CSV or Excel file using C# .
|
|
|
|
|
Iterate through the entries. Locate the duplicate. Remove it. Save the file.
You could locate it by adding all the entries to the collection, and checking for a clash with .ContainsKey each time.
Simon
|
|
|
|
|
|
is it a duplicate row or a duplicate entry in the "key" field?
If it's the latter maybe that attribute needs to be combined with another to form the key for the table
|
|
|
|
|
hi
in my solution, i created a table adapter and set select,insert,update,delete actions to my own stored procedures, then for add row, write the following code :
FrmCategory frm = new FrmCategory(false, false);
DsStack.CategoriesRow newRow = this.dt.NewCategoriesRow();
Session.SaveInSession("newCategory", newRow);
if (frm.ShowDialog() == DialogResult.OK)
{
newRow = Session.LoadFromSession("newCategory") as DsStack.CategoriesRow;
this.dt.Rows.Add(newRow);
this.adapter.Update(this.dt);
}
When my table in database is empty :
the first row add to table successfully, but the second row has not been add to database and the following error has shown me :
Concurrency violation: the UpdateCommand affected 0 of the expected 1 records.
where does my problem and how to solve it ?
thanks
|
|
|
|
|
check your stored procedures!
Strahil Shorgov
|
|
|
|
|
Your Update method waiting for 1 record to be updated, but your update sp doesn't update any row.
Check you sp manually, sent the same values by parameter and watch the results.
|
|
|
|
|
thanks for replies
my sp code is :
Create Procedure [dbo].[sp_Categories_Insert]
@categoryName nvarchar(30),
@description nvarchar(400)
As
Begin
Insert Into Categories
([categoryName],[description])
Values
(@categoryName,@description)
Declare @ReferenceID int
Select @ReferenceID = @@IDENTITY
Return @ReferenceID
End
do i change sp code ?
|
|
|
|
|
When You run this proc, what the value of @ReferenceID?
|
|
|
|
|
Hi alex
the ReferenceID is PK of Inserted Row
|
|
|
|
|
Hi All,
I am developing a web application under ASP.NET 1.1 C# envi.
I have a situation to convert Doc files to PDF when they are getting uploaded into my we application. so the application should convert doc files into PDF internally and display them in a web browser. Also should be able to add text like some free text on every page into PDF file.
I have been trying to find a solution for more than 2 weeks and am failed. i found few forums in this site but couldnt read them because they r too old.
Can any one suggest any third party source SDK to use in .NEt environment?
Your help is very much appreciated. Desperately waiting for any help.
Thanks
Renu
|
|
|
|
|
Please only post to the relevant forum.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi everybody
I have defined a class which has a few properties and an event. It also has a timer, which on its Elapsed event checks a few things and if the condition is met it raises the event. The problem is that the method that is called on the Elapsed event is running in a nother thread, so my event is also raised on the background thread. Is there any way, to raise the event in the main thread(Maybe something like Invoke method in Window class)? Any advice will be appreciated!
Uros
|
|
|
|
|
|
Thanks. I think this will work. Maybe one more thing. If I would not use a Timer, but a background thread, which checks for the same condition, and than goes to sleep for some time, is there any similar way to solve the problem?
Uros
|
|
|
|
|
All Control s have Invoke and BeginInvoke functions that will execute a function on the thread that the control was created on. You could use the watchdog thread to check for your condition and then Invoke some worker function on the main thread if the condition is true and some work needs to be done.
|
|
|
|
|
I guess invoke would work, but my class does not derive from control, so it does not have Invoke or BeginInvoke functions. Here is a simplified example of my class.
public class SomeClass
{
private Thread _workingThread;
public EventHandler SomeEvent;
public SomeClass()
{
_workingThread = new Thread(new ThreadStart(this.checkForCondition));
_workingThread.Start();
}
private void checkForCondition()
{
if(/*Check if condition is met*/)
{
onSomeEvent();
}
System.Threading.Thread.Sleep(5000);
}
private void onSomeEvent()
{
if (SomeEvent != null)
{
SomeEvent(this, new EventArgs());
}
}
}
Uros
|
|
|
|
|
that looks perfectly suited for a timer
|
|
|
|