I have a few for example insert new records, when the store must have "SET IDENTITY_INSERT TabeleName ON"; and "SET IDENTITY_INSERT TabeleName OFF"; other examples do not need 2 lines ON and OFF, if I wanted to give my 2 lines to adjust what ? you see the code below:
Man you are struggling with English, let me see if I can help.
SET IDENTITY INSERT ON will allow you to insert a value into an IDENTITY field, usually a primary key on the table. This is useful if you are moving data from 1 server to another and you have to match ID values.
Under normal circumstances this should NEVER be used. You should be chasing down the business case that required this and find out why it was done.
Never underestimate the power of human stupidity
As per my understanding you are trying to insert few sample records to the database, however I don't understand why you are doing this through code. Or are you trying to read the records from some source and feeding into the database? If that is the case you should use those lines,
SETIDENTITY_INSERT [table_name] ONSETIDENTITY_INSERT [table_name] OFF
For each records inserts.
Alternatively you can set,
SETIDENTITY_INSERT [table_name] ON-- At the beginning
INSERT [table_name] ([ID],,,) VALUES (1,,,)
INSERT [table_name] ([ID],,,) VALUES (2,,,)
SETIDENTITY_INSERT [table_name] OFF-- Terminate after finished inserting all the sample records
However, I don't use this inside the Data access layer. I don't set the identity for the record. Set it to Auto increment for best practice.
I ran a few examples have must command lines ON and OFF new stored it in SQL Server but a few example other no need 2 lines ON OFF but still be stored in SQL Server, I guess on SQL Server to tune in item no need to use on line 2 (ON OFF), because the examples I ran along one machine, data file attch into SQL Server and i don't moving data from 1 server to another and you have to match ID values.
I Downloaded a nifty RTF converter here and among all it's features one of them is converting rtf to html. I Copied the code required to convert a rtf stream to html and added all the necessary dll's to my solution, and syntacticaly speaking the code is fine, all except for one line :
void ConvertRtf2Html(Stream rtfStream)
RtfInterpreterListenerFileLogger logger =
// image converter
// convert all images to JPG
RtfVisualImageAdapter imageAdapter =
RtfImageConvertSettings imageConvertSettings =
imageConvertSettings.ScaleImage = true; // scale images
RtfImageConverter imageConverter =
IRtfDocument rtfDocument = RtfInterpreterTool.Interpret(rtfStream, logger, imageConverter);
// html converter
RtfHtmlConvertSettings htmlConvertSettings =
RtfHtmlConverter htmlConverter = new RtfHtmlConverter(rtfDocument,
} // ConvertRtf2Html
The code below the interpreter comment is where the problem lies - The RtfInterpreterTool.Interpreter Method returns void, not a object of type IRtfDocument. The code block you see above is copied and pasted just as I found it on the page of the developer who coded it, under the example for rtf to html conversion.
The polite thing to do is ask the author in the forum at the end of tthe article[^]. There's very little chance that Jani will happen on by this question, so you need to ask it somewhere that he gets notified of your problem.
I have a problem with background workers, say that I have at a time 50 bw but the number is reducing as they finish their jobs. The last bw's seems to stuck in their work and I cancel them. In this point (when all canceled or done) I have the processor running at 60-70% and the memory is not cleaned. Some help would be appreciated. Thanks.
Well, I would look to use a DataTemplate to satisfy this need. It would consist of an Image and a TextBlock. Oh, I would also have this data being presented as some form of list to the UI, and bind to that list. Have a look at some samples on MVVM to get some practical examples.
Recently, I create a mystery number game and i want to add graphic in it. But I create them for console and now I want to add graphic. I have listen that WPF can do that somebody can explain me what is it and give to me link to know how to use?
A link isn't going to do it for you. The learning curve for Windows Presentation Foundation, an alternative to Windows Forms, is pretty steep. You'd be much better off picking up a book or two on the subject.
I am writing a small app (XMAL/C#/WPF/EF/LINQ) and trying to get my head around the LINQ syntax (I was much happier with SQL). Anyhow, I am having problems returning an ItemSource using the following code:
var sel = (from o in db.r2_machine group o by o.factory into g select g.Key).ToList();
sel = sel.Where(c => c.product_family == TxtProductFamily.Text);
TxtProductFactory.ItemsSource = sel;
I am not sure what I am doing wrong, but I want to display all of the "Factory" fields (grouped), where the "product_family" matches that of one of my comboboxes.
However, the c.product_family value is giving me a compile error and not coming up in the Intellisense list.
NB: Sorry about the semi-colon that got in there when I pasted it in.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)