|
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 ?
|
|
|
|
|
How to retrieve gujarati data from sql server
|
|
|
|
|
You do not retrieve the content based their locale, instead you retrieve the content based on the column.
If your table structure is — annoying — designed as the following,
PK_Table | SomeColumn | GujratiContent | ...
Then you can do something like this,
SELECT GujratiContent FROM table_name
That would return only the content from the column which contains Gujrati data. Other columns would be skipped. But, since SQL Server (or any SQL database) has no idea about the language, locale or content meaning, other than the fact that is it ASCII, Unicode or anything else... It cannot understand how to get Gujrati.
Secondly, if you meant to say that your Gujrati content gets lost, while you store the data in the database and upon retrieval it returns boxes, and question marks only. Then the problem is that you are not storing it as Unicode. Gujrati is an International language, and not English (or Latin), thus you need to use Unicode encoding instead of ASCII. One way to do that is to ensure Unicode data gets inserted, thus when you retrieve, Unicode data will be returned,
INSERT INTO table_name (column1, column2, GujratiContent, column3)
VALUES (1, 'ABC', N'Gujrati data here', DATE());
See this article to understand how Microsoft platforms understand Unicode.
See this article of mine to cross-check, Reading and writing Unicode data in .NET, SQL Server and .NET framework both support Unicode, it is up to you to check how you are passing the data.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Are you asking how you retrieve data entered in the Gujarati script (encoded in a Unicode compliant Gujarati font [^] ) ... not Devanagiri ?
I voted for Afzaal's answer, and you should, too
«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)
|
|
|
|
|
Hello,
I am trying to write a database table to a csv file.
It works, but the problem i have is that it adds an "extra column" without a header but the rest of the cells containing:
System.Data.Linq.EntitySet`1[BookLendingLib.Models.RentedBook]
I am using LinqToSql for my database, and i have 3 tables: Books, Readers, and RentedBooks(RentedBooks being an associative table with BookId and ReaderId to define the books rented by a reader).
In my database designer file the RentedBook is "tagged" as an AssociationAttribute and i assume its related to the RentedBooks table.
What should i do to fix this?
These are the methods i use to export to csv:
<pre>private static IEnumerable<string> ToCsv<T>(IEnumerable<T> list)
{
var fields = typeof(T).GetFields();
var properties = typeof(T).GetProperties();
foreach (var @object in list)
{
yield return string.Join(",",
fields.Select(x => (x.GetValue(@object) ?? string.Empty).ToString())
.Concat(properties.Select(p => (p.GetValue(@object, null) ?? string.Empty).ToString()))
.ToArray());
}
}
private void ExportBookDb(string saveFilePath)
{
BookDBDataContext bDC = new BookDBDataContext();
if (ExclBookList != null)
{
ExclBookList.Clear();
}
ExclBookList = new ObservableCollection<Book>(bDC.Books);
Book bPropNames = new Book();
using (StreamWriter textWriter = File.CreateText(saveFilePath + ".csv"))
{
textWriter.WriteLine(nameof(bPropNames.Id) + "," + nameof(bPropNames.Title) + "," + nameof(bPropNames.Author) + "," + nameof(bPropNames.Isbn) + "," + nameof(bPropNames.Quantity) + "," + nameof(bPropNames.RezervedQty));
foreach (var line in ToCsv(ExclBookList))
{
textWriter.WriteLine(line);
}
}
Thank you in advance!
|
|
|
|
|