|
i am not using database in project. my module fully depend on xml file. i use dataset & xdocument class to load data from xml. i use Trim() & ToUpper() if data has space or not in same case. just to match the data properly i use Trim() & ToUpper() function.
please tell me what is wrong with Trim() & ToUpper() functions ? what wrose can happen if we use Trim() & ToUpper() function? please guide if possible for the bad consequences of Trim() & ToUpper() function. thanks
|
|
|
|
|
Nothing is wrong with them.
Just when you go to do your query, you're going it in memory in a DataSet or DataTable. Those are not really optimized to do queries against. There are no indexes in a DataSet or DataTable. So when you go do your query, you're doing what's called a "table scan". You're looking and comparing every single row in every table involved in the query. You're also running both Trim and ToUpper on every single field you specified them on for every single row in all of your related tables. You're calling those methods literally tens of thousands of times, which is going to slow your query speed considerably.
An XML file is NOT a database. XML is used to format data for transfer. If you're trying to use an XML file as a database, you're making a huge mistake.
You could improve query performance while still using an XML file, but you're going to be writing code to
* custom build a DataSet, with all of your related DataTables,
* importing the data from the XML file with custom code, including calling Trim and ToUpper to normalize the data,
* creating DataView objects on your tables, and sorting them appropriately which will create indexes that will improve query performance.
But, you're never going to get the performance of a dedicated database engine that's built for the purpose of querying.
|
|
|
|
|
Hopefully you own the database because it REALLY stinks, you are making joins on text fields which you have not validated on the entry. It also seems like you have no referential integrity in your database other than user input.
In other words you have created a disaster in your database. As Dave said you need to go back to the beginning and redesign your database so it conforms to proper data structures. This site may help you Data Models[^] but I suspect you need to get a book and start learning, it cannot be done via forum posts.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Sir i am not using db rather using xml file from where i read data. thanks
|
|
|
|
|
How to make code run differently depending on the platform it is running on?
I have a challenge for you.
I have an ASP.NET Web Application built in C# with Microsoft Visual Studio 2017. There is a line of code that we have had to include in order for it to run on a localhost when debugging by attaching it to a running process in a web browser.
Here is the issue. That line of code is not necessary when the process is running on the server.
I can remove that line when I submit the code in TFS. But it would be great if we could make the code somehow ignore that line depending on what platform it is running on.
How can you think this could be done?
|
|
|
|
|
|
|
I would question why that line is needed at all. Perhaps your real problem is figuring out what process to attach to when you want to debug. If so you can log the process id. That provides all that you need.
Other than that there is a problem with running code one way on some machines and then running it differently in production. That is because you are not then testing the code that runs in production. Consequently problems can occur in production for which you have no way to replicate exception in production.
|
|
|
|
|
my project dont buil. my code is true
|
|
|
|
|
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
But ... if your code was "true" (we would say "correct") then it almost certainly would build, so you need to start by looking at what it is telling you as to why it won't. Assuming that you have actually tried to build it - and you'd be surprised how many don't realise you have to press a button or a keyboard key to do that - then Visual Studio tries very hard to give you understandable error messages.
Start by looking at two places (both accessible from the VS "View" menu if you can't see them):
1) The error pane. This contains a list of all the problems VS found when you tried to compile. If this is empty, then the chances are it compiled OK. If it isn't read the message and double click it - that will take you to the line it didn't like. Even Warnings should be checked if you are a beginner, they are there because you are doing something that is probably wrong!
2) The output pane. This shows a summary of the build process, and also any problems that occured during run time if you got that far.
Assuming that Errors is empty and Output looks fine, you need to look at your code and exactly what is actually happening.
If you can't work it out, show us your code, and any messages, and give us loads of detail as to what you tired that produced it - the better your question, the better our response can be. Typing as little as possible helps nobody!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
What would you like us to do?
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
There's about 1 million different reasons why your code won't compile. Since you didn't provide any information on your code and the errors being thrown in your post, it's impossible for anyone to help you.
|
|
|
|
|
Good Day All
i have a unicode character which works very well
UnicodeString Thinking =0x1f914;
as you can see the value here is "0x1f914"
so i use this site which has a list of emoji's Full Emoji List, v12.0
but the code in that website is "U+1F914"
how do i convert U+1F914 to 0x1f914 in c#
thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vimalsoft.com
vuyiswa[at]vimalsoft.com
|
|
|
|
|
Directly? You can't. char is a UTF-16 value: is can't hold values higher than 0xFFFF because it only has space for 16 bits - your emoji value is 17. You are going to have to do a lot more than just convert it to hex, you will have to start playing with UTF32: UTF32Encoding Class (System.Text) | Microsoft Docs[^]
But to hex, or even an Int32 is simple:
string siteCode = "U+1F914";
int i = Convert.ToInt32(siteCode.Replace("U+", "0x"), 16);
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Good Day
After i looked closely on the string , with lack of knowledge of the unicode stuff , i realized i just needed to replace the character and the emoji will be translated , the code below simply solved the problem
<pre lang="c#">txtresults.Text = txttext.Text.Replace("U+", "0x").ToLower();</pre>
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vimalsoft.com
vuyiswa[at]vimalsoft.com
|
|
|
|
|
I have started a local host application and I attached a project in visual studio to this iexplorer process what was running the app. But I am unable to set break points in the code. I have tried to set break points but the errors says:
"This breakpoint will not currently be hit. No symbols have been loaded for this document."
Please advise.
|
|
|
|
|
|
The solution is to attach it to the w3wp process, not the iexplorer or any browser process.
|
|
|
|
|
ASP.NET, MVC, WebApi, ..., code always runs entirely on the server side, not in the browser. You're looking for your code in the wrong process.
|
|
|
|
|
The solution is to attach it to the w3wp process, not the iexplorer or any browser process.
|
|
|
|
|
I have a generic class with a complex signature that I would like to simplify for convenience if all of the type parameters will be the same.
MyClass<T1, T2, T3, T4>
If all of the type parameters are Guid, I'd like to supply just one type parameter, the only way I can think of doing it would be to have another class defined.
MyClass<T1> : MyClass<T1, T1, T1, T1>
Is there a better method of achieving this functionality? Is this a bad practice and should I just always use the verbose signature? Ultimately, I don't want there to be anything different between the classes other than the ability to use a simplified signature.
|
|
|
|
|
|
upvoted, and I mention you in my response here
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
Failwyn wrote: Ultimately, I don't want there to be anything different between the classes other than the ability to use a simplified signature.
The answer depends on what you mean by that statement.
The derived class is the only solution I can see. But the types would not be exactly the same:
MyClass<Guid> a = new MyClass<Guid>();
MyClass<Guid, Guid, Guid, Guid> b = a;
MyClass<Guid> c = b; And:
MyClass<Guid, Guid, Guid, Guid> a = new MyClass<Guid, Guid, Guid, Guid>();
MyClass<Guid> b = (MyClass<Guid>)a;
MyClass<Guid> c = a as MyClass<Guid>;
Within a single file, you could use a using statement to create an alias for the type. But you can't use generic type parameters in the alias, so you'd need a different one for each set of type parameters you wanted to use:
using MyClassGuid = MyClass<Guid, Guid, Guid, Guid>;
...
MyClassGuid a = new MyClassGuid(); You'd also have to repeat the alias in each file where you needed to use it.
If it's constructing the objects you're worried about, then a factory method might help:
public static class MyClass
{
public static MyClass<T1, T2, T3, T4> Create<T1, T2, T3, T4>(T1 value1, T2 value2, T3 value3, T4 value4)
{
return new MyClass<T1, T2, T3, T4>(value1, value2, value3, value4);
}
public static MyClass<T1, T1, T1, T1> Create<T1>(T1 value)
{
return new MyClass<T1, T1, T1, T1>(value, value, value, value);
}
}
...
MyClass<Guid, Guid, Guid, Guid> a = MyClass.Create(Guid.New());
MyClass<string, int, decimal, DateTime> b = MyClass.Create("Hello", 42, 123.45M, DateTime.Today);
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Whoa !
Error CS0308 The non-generic type 'MyClass' cannot be used with type arguments
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|