|
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,
SET IDENTITY_INSERT [table_name] ON
SET IDENTITY_INSERT [table_name] OFF
For each records inserts.
Alternatively you can set,
SET IDENTITY_INSERT [table_name] ON
INSERT [table_name] ([ID],,,) VALUES (1,,,)
INSERT [table_name] ([ID],,,) VALUES (2,,,)
....
....
SET IDENTITY_INSERT [table_name] OFF
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.
|
|
|
|
|
When you have column in your table declared as identity field you should not insert value into it. SQL will handle the value for that column!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
In order to insert the values in the Identity column, you should use "SET IDENTITY_INSERT TableName OFF" otherwise you didn't require that for every insert command.
|
|
|
|
|
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 =
new RtfInterpreterListenerFileLogger(@"c:\temp\RtfInterpreter.log");
RtfVisualImageAdapter imageAdapter =
new RtfVisualImageAdapter(ImageFormat.Jpeg);
RtfImageConvertSettings imageConvertSettings =
new RtfImageConvertSettings(imageAdapter);
imageConvertSettings.ScaleImage = true;
RtfImageConverter imageConverter =
new RtfImageConverter(imageConvertSettings);
IRtfDocument rtfDocument = RtfInterpreterTool.Interpret(rtfStream, logger, imageConverter);
RtfHtmlConvertSettings htmlConvertSettings =
new RtfHtmlConvertSettings(imageAdapter);
htmlConvertSettings.StyleSheetLinks.Add("default.css");
RtfHtmlConverter htmlConverter = new RtfHtmlConverter(rtfDocument,
htmlConvertSettings);
Console.WriteLine(htmlConverter.Convert());
}
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.
How do I proceed now?
Thank you for your time.
|
|
|
|
|
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.
|
|
|
|
|
Hi,
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.
|
|
|
|
|
Without seeing any code, this is impossible to diagnose. I would suggest that you download a profiler and run it to see what's not getting freed up.
|
|
|
|
|
Hi, I am trying to use PathGradientBrush in my C#/WPF application, but I keep getting error "The type/namespace PathGradientBrush not found".
Is that specificit to a particular .Net version?
Thanks!
|
|
|
|
|
PathGradientBrush is a Windows Forms brush, not a WPF brush. You cannot apply it in WPF.
|
|
|
|
|
|
hi to friends
how to load contact list(jabber xmpp) in listview with status icon? wpf dont have image list...!
i use this code in windows form application :
private void OnPresence(object sender, agsXMPP.protocol.client.Presence pps)
{
if (base.InvokeRequired == true)
{
base.BeginInvoke(new agsXMPP.protocol.client.PresenceHandler(OnPresence), new object[] { sender, pps });
}
else
{
if (pps.Type == PresenceType.available)
{
for (var i = 0; i < listView1.Items.Count; i++)
{
ListViewItem item = listView1.Items.Add(pps.From.User, 0);
}
}
try
{
if (pps.Type == PresenceType.unavailable)
{
for (var i = 0; i < listView1.Items.Count; i++)
{
ListViewItem item = listView1.Items.Add(pps.From.User, 1);
}
}
}
catch
{ }
}
}
ListViewItem item = listView1.Items.Add(pps.From.User, 0); > load online contact with green icon 0
istViewItem item = listView1.Items.Add(pps.From.User, 1); > load offline contact with red icon 1
and can you help me to load contact with status icon In WPF Listview??? like this image :
http://i62.tinypic.com/v7dphi.png[^]">
|
|
|
|
|
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?
Thanks
|
|
|
|
|
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.
|
|
|
|
|
As Dave says above, the learning curve for WPF is quite steep. But you can get a flavour of it by looking at some of the CodeProject articles[^].
|
|
|
|
|
|
|
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.
modified 9-Jun-14 11:22am.
|
|
|
|
|
Take out the semicolon:
...sel.Where(c =>; c.product_family... Becomes:
...sel.Where(c => c.product_family...
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 – ∞)
|
|
|
|
|
Sorry about that - it was an issue when I pasted it.
|
|
|
|
|
Is the product_family defined on the r2_machine ? Your first line is pulling back a list of factories, so if your factory class doesn't have that field, your filter is too late.
Try:
var sel = (from o in db.r2_machine
where o.product_family == TxtProductFamily.Text
group o by o.factory into g
select g.Key).ToList();
If you haven't already seen it, LINQPad[^] is a good place to start learning the syntax.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
That's perfect - thank you so much.
|
|
|
|
|
In the Name of God
Hi
I have 2 question
1)does Filebrowser control have ablitty to search and select multiple photo at the same time?
if it is so how?
2)I want to split a cell to multiple row in gridline in C#
if you know suitable software or source code i need your help
For example, a person whose name is Jhon and has several job i want to show him in a one row with all his job
name job
jhon programmer
actor
thanks
|
|
|
|
|
1. Which one of these controls[^] are you interested in?
2. You may need to write the code for that yourself.
|
|
|
|