|
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
|
|
|
|
|
I am using Visual c++ NET 2005 and using for my report CrystallReport.
I didn't yet seen an example for that at C++ or C#. I try to translate VB example but I don't succed. When I display report, I have a screen asking to fill the value of parameters.
I need help, an example of how to fill programmatically parameters and load report in Visual c++ NET or C#
|
|
|
|
|
there aren't many examples on crystal reporting.
i dreamt up a little work around that basically creates a DataTable with my parameters in it. then i add it to the DataSet before i pass it to the report.
i strongly suggest that you buy a book on crystal report's. i did, still waiting for it tho so I'm no crystal expert... YET
good luck
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
|
i helped you!?
i gave you two options, so pick one and run with it
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
Hello every 1,
I am using ToolStrip in one of my projects. I want to get a handle (Intptr)
to ToolStripButton in the Tollstrip.
But the ToolStripButton does not have a handle property.
Can any 1 help me out in this issue.
o O º(`'·.,(`'·., ?,.·''),.·'')º O o°
»·'"`»* *? t4ure4n ?* *«·'"`«
°o O º(,.·''(,.·'' ?`'·.,)`'·.,)º O o°
modified on Thursday, June 12, 2008 7:07 AM
|
|
|
|
|
And what do you plan on doing with the handle once you found it?
|
|
|
|
|
Actually i want to embedd custom fonts in the app and use them on the clients machine i.e without installing the fonts on their machines.
I use a class that create a bin file from the font file.
To use this font I have a method in my FontEmbedder class
This method requires the handle to the control that contains the text to be shown.
o O º(`'·.,(`'·., ?,.·''),.·'')º O o°
»·'"`»* *? t4ure4n ?* *«·'"`«
°o O º(,.·''(,.·'' ?`'·.,)`'·.,)º O o°
|
|
|
|
|
Is it possible to target Silverlight using C# 2008 Express yet?
|
|
|
|
|
SP1 AFAIK (or was that just for MVC?).
|
|
|
|
|
Thanks, I'll give it a go and risk the SP1 Beta.
|
|
|
|