|
The code you have shown above does not match the code in the error message display.
|
|
|
|
|
Can you tell why the error was caused by considering the error picture?
|
|
|
|
|
Sorry, but I have looked again, and checked the documentation and cannot see what is wrong.
|
|
|
|
|
Whenever I get a SQL error like this, I try to run it directly against the server. You really should try this because the exception you are seeing is telling you that your query is wrong. That's what you're going to have to fix - the problem has nothing to do with C#, or the fact you are running over a web service.
This space for rent
|
|
|
|
|
Additional suggestion to that.
Figure out how and where the replacements are done in the SQL and the log the SQL with those replacements.
Then use that for your test.
If you do not do that then you are guessing about what the SQL actually looks like. Which might work, and also might not.
|
|
|
|
|
Hey guys,
To day i want to ask :
" <pre>How to create a virtual disk storage software in c #</pre>
Everyone can help me ???
Help me??
|
|
|
|
|
It starts first with defining in great detail what you mean by "virtual disk storage software" and all of the features you want in it.
|
|
|
|
|
Something like this[^]?
Not the most recent article, but should be enough to get you started.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi good day to all, I'am using a panel that have scrollbar in vertical. I want to display a new value of scroll bar when i end scrolling and I use this code
private void panel1_Scroll(object sender, ScrollEventArgs e)
{
if (e.Type == ScrollEventType.EndScroll)
{
MessageBox.Show(e.NewValue.ToString());
}
}
but it does not work, but when i use a single vertical scroll bar and use it this code :
private void hScrollBar1_Scroll(object sender, ScrollEventArgs e)
{
if (e.Type == ScrollEventType.EndScroll)
{
MessageBox.Show(e.NewValue.ToString());
}
}
it will work, I thought i can use the same code but it fails, Is their any way to do that?
Thank you in advance
|
|
|
|
|
Lawliet0727 wrote: I'when i use a single vertical scroll bar But, your code that follows this is an EventHandler for a Horizontal ScrollBar ?
In the 'panel1_Scroll EventHandler, try writing the value to the Console, or to a TextBox on the Form: the use of MessageBox sometimes has side-effects since it's a thread-blocking call.
«While I complain of being able to see only a shadow of the past, I may be insensitive to reality as it is now, since I'm not at a stage of development where I'm capable of seeing it. A few hundred years later another traveler despairing as myself, may mourn the disappearance of what I may have seen, but failed to see.» Claude Levi-Strauss (Tristes Tropiques, 1955)
|
|
|
|
|
When designing a form dragging objects (forms) into an edit and delete form, somehow the object on the form is deleted but the code in the form (Form.Designer.cs) does not delete the form. Is there a way to quickly find code not deleted in the above file ?
|
|
|
|
|
A simple possible explanation could be that you delete a dropped Control from a design-time WinForm surface, but, you have not re-built the project/solution ... in that case, what's in the designer.cs file could be out of synch with the Form. However: if that is not what's happening here:Quote: When designing a form dragging objects (forms) into an edit and delete form, Hi, what you describe I find difficult to understand. Could you clarify;
1. is this WinForms ?
2. you are talking about design time drag-drop, or run-time ?
3. "dragging objects (forms) into an edit and delete form" this suggests you are dragging/dropping a Form ? that's not WinForms.
4. "edit and delete form" what, exactly, is this ?
cheers, Bill
«While I complain of being able to see only a shadow of the past, I may be insensitive to reality as it is now, since I'm not at a stage of development where I'm capable of seeing it. A few hundred years later another traveler despairing as myself, may mourn the disappearance of what I may have seen, but failed to see.» Claude Levi-Strauss (Tristes Tropiques, 1955)
modified 11-Aug-17 3:31am.
|
|
|
|
|
I am using winforms, my english is not good so the expression makes you confuse. This means that when I am in form design mode when dragging control into a form, adding, editing, and deleting controls on the form, for some reason the code control on the form is not removed in the Form.Designer file.cs. but Form.cs (UI) has deleted very well. Do you understand me ?
|
|
|
|
|
If you find this happening, raise a bug report with Microsoft. This would indicate the fault is in their tooling,
This space for rent
|
|
|
|
|
I do not think it is necessary because VS2005 is old.
|
|
|
|
|
How to store viewstate values in specified folder? I have designed a page and it contains textboxes to accept data fron user so i want to store the values in specified folder using viewstate?
Please help.
Thanks in advance
|
|
|
|
|
ViewState is used to persist the state of the view between requests. It is typically stored in one or more hidden fields on the page.
It has nothing to do with storing values in a folder.
ASP.NET View State Overview[^]
Understanding ASP.NET View State[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
In C# VS2005 I embedded a picture (file in the form *.png) normal but when the rebuild was reported The "GenerateResource" task failed unexpectedly.
System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI +. Have you know how to fix this ?
|
|
|
|
|
I can't do this because the MemoryStream is immutable: (code excerpt)
using(MemoryStream mstream = new MemoryStream(File.ReadAllBytes(filepath)))
{
if (useDecryption)
{
mstream = decryptor(mstream);
mstream.Position = 0;
}
if (useDecompression)
{
mstream = decompressor(mstream);
mstream.Position = 0;
}
result = (T) dcs.ReadObject(mstream)
} So, okay, I can do this: (code excerpt)
MemoryStream mstream = new MemoryStream(File.ReadAllBytes(filepath));
if (useDecryption)
{
mstream = decryptor(mstream);
mstream.Position = 0;
}
if (useDecompression)
{
mstream = decompressor(mstream);
mstream.Position = 0;
}
result = (T) dcs.ReadObject(mstream); But that violates my early .NET memory-potty-training.
Best/better practice ? Perhaps better to pass a byte array ?
thanks, Bill
«While I complain of being able to see only a shadow of the past, I may be insensitive to reality as it is now, since I'm not at a stage of development where I'm capable of seeing it. A few hundred years later another traveler despairing as myself, may mourn the disappearance of what I may have seen, but failed to see.» Claude Levi-Strauss (Tristes Tropiques, 1955)
modified 10-Aug-17 0:32am.
|
|
|
|
|
Disposing a MemoryStream doesn't release any unmanaged resources. It simply sets some flags to indicate that future attempts to read or write the stream should throw an exception.
protected override void Dispose(bool disposing)
{
try {
if (disposing) {
_isOpen = false;
_writable = false;
_expandable = false;
#if FEATURE_ASYNC_IO
_lastReadTask = null;
#endif
}
}
finally {
base.Dispose(disposing);
}
}
Reference Source[^]
Despite the comment about the base method cleaning up async IO resources, it doesn't:
protected virtual void Dispose(bool disposing)
{
}
Reference Source[^]
But I know what you mean - it doesn't feel right to omit the using statement.
Perhaps a helper method to create the stream might help to hide the unpleasantness?
private static MemoryStream CreateStream(byte[] rawBytes, IEnumerable<Func<MemoryStream, MemoryStream>> decorators)
{
var result = new MemoryStream(rawBytes);
foreach (Func<MemoryStream, MemoryStream> decorator in decorators)
{
result = decorator(result);
result.Position = 0;
}
return result;
}
...
var decorators = new List<Func<MemoryStream, MemoryStream>>();
if (useDecryption) decorators.Add(decryptor);
if (useDecompression) decorators.Add(decompressor);
using (MemoryStream mstream = CreateStream(File.ReadAllBytes(filepath), decorators))
{
result = (T)dcs.ReadObject(mstream);
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks for another interesting, and challenging, response !
My "gut" is now telling me to switch to using byte-arrays wherever possible. Whether you gain anything (performance, memory economy) when shipping the raw data off to be encrypted and/or compressed by using a byte-array rather than a stream ... that's terra incognita to me ... but, I suspect that as I research the various tools that will come into focus.
cheers, Bill
«While I complain of being able to see only a shadow of the past, I may be insensitive to reality as it is now, since I'm not at a stage of development where I'm capable of seeing it. A few hundred years later another traveler despairing as myself, may mourn the disappearance of what I may have seen, but failed to see.» Claude Levi-Strauss (Tristes Tropiques, 1955)
|
|
|
|
|
The benefits would probably be more obvious if you were passing around the base Stream class. That way, your methods could work with anything stream-like, and wouldn't be limited to byte arrays.
private static Stream DecorateStream(Stream input, IEnumerable<Func<Stream, Stream>> decorators)
{
Stream result = input;
foreach (Func<Stream, Stream> decorator in decorators)
{
result = decorator(result);
}
return result;
}
...
var decorators = new List<Func<Stream, Stream>>();
if (useDecryption) decorators.Add(decryptor);
if (useDecompression) decorators.Add(decompressor);
using (Stream input = DecorateStream(File.OpenRead(filePath), decorators)))
{
result = (T)dcs.ReadObject(input);
}
Now your code can work on the file in chunks, rather than having to read the whole thing into memory first.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi,
I have solution that is using Entity Framework 4 database first approach. When I add something new to database mappings of edmx file are not properly changed to reflect changes in a database, so I get famous error "entity is not part of the current context".
I have tried to Run custom tool and also Transform T4 templates but none of these options gave me a solution to this problem. I'm using Visual Studio 2010 and 2012.
Does anyone know the exact steps that needs to be taken in order to DbContext be synced with database model. Since I have existing database I would like to stick with database first approach. I would like to be able to add and modify objects in database and after "Update Model from database" to have all mapped and in sync.
Thanks
|
|
|
|
|
Upgrade to the latest version of EF (which is, like, version 6 or 7).
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Thanks, but I have tried that already and for some reason reference to EF 4 always get pulled into project. Is there a way to stay with EF 4 and to normally work with db changes ?
|
|
|
|