Click here to Skip to main content
14,979,837 members

Comments by Tomas Takac (Top 200 by date)

Tomas Takac 29-May-20 2:25am View
   
Print out content of @sqlTrigger1 and try to run it manually, this should give you more info.
Tomas Takac 28-Apr-20 2:40am View
   
If those are XML files, you can read them as such and only do the replace in values and not keys.
Tomas Takac 24-Apr-20 2:36am View
   
You can have a look at the source code of a IoC container and find out for yourself. Here are the sources for Unity container[^] for example.
Tomas Takac 21-Apr-20 2:21am View
   
With the data you show there should be no duplicates. Try to run this to see where it is duplicated:
select a.userid, b.userid, c.userid
from Able a
left join Brake b on b.userid = a.userid
left join Cost c on c.userid = a.userid
Tomas Takac 8-Apr-20 2:23am View
   
It is not clear what you are asking. The code is supposed to go to the catch in your method, then the same exception is re-thrown and caught somewhere up the call chain. Or crashes your program if not caught. The try-catch as shown in your example is useless, you may as well remove it. Anyway, I think you should update your question and also show the code which calls this method but you don't get the exception there as expected.
Tomas Takac 30-Mar-20 1:56am View
   
Tomas Takac 28-Mar-20 9:11am View
   
Point taken. I only showed how to search for minimum because I thought that modifying it for max is trivial. I should have stated this explicitly.
Tomas Takac 28-Mar-20 9:09am View
   
This is not a trivial question. Only brute force approach will be guaranteed to find all the extrema. The limitation of course is that you are able to search the whole set in a reasonable time. There are techniques to find global min/max like Simulated annealing[^]. I don't recall any technique to find all the local extrema though.
Tomas Takac 24-Mar-20 6:22am View
   
And where is the problem?
Tomas Takac 4-Mar-20 7:53am View
   
dt = dt.AddMonths(monthCounter) - this was modifying the original variable, the trick is to preserve original value of dt and add number of months to it.
Tomas Takac 4-Mar-20 6:53am View
   
My bad, I fixed the bug, check again.
Tomas Takac 4-Mar-20 5:46am View
   
I updated my answer with your code, how it should look like. But you need to understand the concepts and be able to apply them in different situation.
Tomas Takac 27-Feb-20 3:07am View
   
For me scanning for a specific string raises a red flag, it is weird to hard code it like this. My feeling is that this flags are attributes of the answer itself so if you have an entity survey and entity answer then joining and aggregating by some personid should give you your answer.
Tomas Takac 28-Jan-20 7:48am View
   
Depends on you use case. If this works for you, then it's ok. My example matches the records having CodeType NULL on both sides.
Tomas Takac 14-Jan-20 3:51am View
   
How about
Guid.NewGuid().ToString("N")
or
DateTime.UtcNow.ToString("yyyyMMddHHmmss")
if you want to generate "unique" id.
Tomas Takac 9-Jan-20 5:57am View
   
Great. BTW I don't think you want to increment padding. Instead you may want to do something like this:
int padding = input.Length;
int number = int.Parse(input);
foreach... number++
Tomas Takac 9-Jan-20 5:55am View
   
This creates a string format template, {{ and }} is to escape the curly brackets to put create string like {0:d0<your number="" here="">}. Now I'm thinking this is easier:
string format = string.Format("d0{0}", padding);
int paddedNumber = number.ToString(format);
Tomas Takac 8-Jan-20 15:54pm View
   
I don't follow. The input variable in the sample represents your input. Try to run it with input = "01" and you will see it works.
Tomas Takac 8-Jan-20 15:38pm View
   
I updated the solution, what about now?
Tomas Takac 25-Nov-19 6:29am View
   
Are you sure the row was inserted while the first transaction was processing? Try to do the same with two windows open in management studio and you will see that the second transaction will be blocked until the first commits.
Tomas Takac 12-Nov-19 2:56am View
   
ELEMENTO is datetime? Also please update your question with the expected output.
Tomas Takac 13-Nov-18 3:10am View
   
It feels like you need a cross join between UserDetail and UserMenu but I'm not sure. Maybe update your question with sample input and expected output to make it more clear.
Tomas Takac 17-Aug-18 5:28am View
   
You are supposed to show your code in the "What I have tried" section.
Tomas Takac 15-Aug-18 11:02am View
   
Not sure if I recall this correctly, but UDF must not change database and temp tables are real tables in tempdb while table variables are just in memory.
Tomas Takac 26-Jul-18 6:05am View
   
I believe you are looking for GROUP BY[^].
Tomas Takac 22-Mar-18 3:35am View
   
How are you writing the CSV file? Please update your question with the code.
Tomas Takac 15-Mar-18 20:03pm View
   
First, you do not so many queries. You are querying table rubrique three times to get nomrubrique, then the count, then nomrubrique again. This is not necessary.

Second, you should store your data differently. Keep your rubrique table. Remove columns salary, trans, panier, congé from employee table. Create a new table rubrique_employe with columns idemployee, idrubrique, montant. That should solve your problems.
Tomas Takac 22-Feb-18 7:20am View
   
Unfortunately NULL is treated as lowest value by SQL Server. Here are some workarounds: SQL Server ORDER BY date and nulls last - Stack Overflow[^]
Tomas Takac 22-Feb-18 6:29am View
   
You have specified `ORDER BY NumeroCapitolo` and this is what you got. If you want different ordering you need to change your ORDER BY statement.
Tomas Takac 23-Jan-18 7:25am View
   
I believe you are looking for specification pattern[^]. But it really depends on what you are trying to achieve. Maybe posting your code (via Improve question) to illustrate the problem would clear things up and you could get a more specific answer.
Tomas Takac 18-Jan-18 8:26am View
   
see ms docs for XslCompiledTransform Class[^]
Tomas Takac 16-Jan-18 10:02am View
   
Good idea. I guess he also needs to wrap the collections as <inports><inport/><inport/>....</inports>
Tomas Takac 16-Jan-18 6:46am View
   
You are right, this doesn't look very traditionally. Can you tweak how the XML is generated? Maybe there is a parameter which drives this.
Tomas Takac 18-Dec-17 3:30am View
   
That's easy: get the managers, order by their salaries, select top 3. You need to show us what you tried = the code you wrote. And you need to explain what does not work. But even then it's unlikely you get more than a few hints because this basically screams: "do my homework for me".
Tomas Takac 20-Nov-17 7:17am View
   
Why do you need to insert the header into an existing file? Why not write header first and then write data?
Tomas Takac 20-Nov-17 6:06am View
   
You need to debug it and check what's the value of data._Stu.
Tomas Takac 20-Nov-17 2:51am View
   
You mean the three columns you add within the "if"? Did you try to debug it?
Tomas Takac 12-Nov-17 10:10am View
   
You actually didn't state what your problem is. Please put your code in the "What I have tried" section and explain what is not working.

BTW you can use the DATEPART function[^] to get the quarter.
Tomas Takac 3-Nov-17 11:18am View
   
You don't need to insert into #tmp1 and delete. Simply SELECT Id,grpid,pass from TempEmp WHERE duplicateRecCount = 1. Alternatively you could do this using union.
Tomas Takac 20-Oct-17 2:24am View
   
I don't understand your expected results. Could you explain in more detail?
Tomas Takac 25-Sep-17 5:53am View
   
The memory doesn't need to be released right away. Does the memory usage grow over time? Do you suspect a memory leak? Then you should use a memory profiler to find the source of the problem.

Are you saying the object you are sending over WCF implements IDisposable? I would avoid that and use a POCO message class to exchange data. In any case you should check if you implement the IDisposable pattern correctly, including the call from finalizer.

Last but not least, update your question (via Improve question) and add some code to illustrate your problem.
Tomas Takac 25-Sep-17 3:47am View
   
Why? What's your motivation for tampering with memory management? You do know that memory is managed automatically in C#/.NET right?
Tomas Takac 29-Aug-17 8:47am View
   
1) Do not put code in comments, update your question instead (via Improve question).
2) Use "Reply" button to reply to a comment otherwise people won't get notified of your reply.
Tomas Takac 16-Aug-17 7:39am View
   
You need to show the code that produced this string. Please use Improve question to update your question. Your code should go into the "What I have tried" section.
Tomas Takac 9-Aug-17 4:34am View
   
The problem is not clear from you post. What are you struggling with? Can you update your questions (via Improve question) with some sort of code?
Tomas Takac 25-Jul-17 7:52am View
   
I know about iTextSharp library - should make a good starting point. Also try to google there ought to be more pdf libraries out there.
Tomas Takac 25-Jul-17 7:12am View
   
Parse the string into a DateTime the format as needed. Where is the problem?
Tomas Takac 21-Jul-17 2:31am View
   
Your linq seems to be ok, what's the problem? Do you get a compiler error, a runtime error, it doesn't return expected results?
Tomas Takac 18-Jul-17 7:21am View
   
If you already have your database you can generate your object model from it using Entity Framework [^].
Tomas Takac 17-Jul-17 6:45am View
   
You are missing the FROM clause. The query must look like this: SELECT ... FROM category LEFT JOIN file ON ...
Tomas Takac 27-Jun-17 5:04am View
   
Try this format: "MMM dd yyyy h:mmtt"
But the extra space there seems to be causing problems.
Tomas Takac 27-Jun-17 3:39am View
   
I would suggest you talk about this to your colleagues. If you loop them in now you will avoid unwanted surprises later. It is also good to have some sort of agreement on how to solve this so everybody knows why this is happening and why you picked this particular solution.
Tomas Takac 21-Jun-17 5:46am View
   
You should update your question with the code you use for testing. FYI ^[0-9]{1,14}$ works as expected for me with the examples you gave.
Tomas Takac 20-Jun-17 2:19am View
   
There is a CsvWriter class, try to use that. You need to write to another than source file though.
Tomas Takac 31-May-17 11:01am View
   
If you are trying to impersonate a local user from ComputerA on ComputerB then that won't work. Try this: c# - How to provide user name and password when connecting to a network share - Stack Overflow[^]
Tomas Takac 30-May-17 3:15am View
   
I don't understand what's the problem with your code.
Tomas Takac 29-May-17 7:15am View
   
Use the reply button otherwise the author of the comment won't be notified of your reply.
Tomas Takac 22-May-17 6:38am View
   
I'm sorry, but I don't know anything about the component you are using. You need to read the documentation or contact the author.
Tomas Takac 22-May-17 5:32am View
   
You are retrieving year and month values but not using those anywhere. If you are confused, as you said, please explain why, what confuses you, in detail.
Tomas Takac 22-May-17 4:37am View
   
There is no reference to year or month in your code. How are we supposed to know what are you talking about? Maybe you should start by naming your variables in a meaningful way instead of A,B,C,...
Tomas Takac 19-May-17 4:31am View
   
Use the Reply button otherwise user won't be notified of your comment.
A question: why do you need to show arbitrary binary data in a textbox?
Tomas Takac 16-May-17 7:14am View
   
What you are doing there is just changing the file extension and that won't work. The word you are looking for is "conversion". Try to google that in conjunction with pdf, doc...
Tomas Takac 5-May-17 2:41am View
   
My guess is PdfReader can only read local files.
Tomas Takac 2-May-17 9:10am View
   
I'm saying your code is just fine as it is now, do not complicate it unnecessarily.
Tomas Takac 28-Apr-17 4:08am View
   
Why do you need to validate the value with the regex? It would be easier to parse the value and then check the range.
Tomas Takac 25-Apr-17 7:46am View
   
Perhaps they are using different seed.
Tomas Takac 21-Apr-17 8:16am View
   
I'm sorry but I don't see the stack trace or the error message.
Tomas Takac 21-Apr-17 6:38am View
   
Update your question with the full stack trace and error message and I will have a look.
Tomas Takac 21-Apr-17 2:31am View
   
You didn't actually state your problem. Tell us what's wrong.
Tomas Takac 20-Apr-17 10:09am View
   
I updated the solution, have a look.
Tomas Takac 20-Apr-17 9:56am View
   
I see, this won't work then...
Tomas Takac 20-Apr-17 9:01am View
   
I don't think removing foreign keys is a valid solution here. OP needs to clean up the data instead.
Tomas Takac 20-Apr-17 8:58am View
   
I get 2y 3m 14d which I think is correct assuming @date=6-Jan-2015 and @now=20-Apr-2017.
Tomas Takac 20-Apr-17 5:07am View
   
To contact the author go to the article and there is a discussion forum there at the end of it. Ask your question there.
Tomas Takac 20-Apr-17 3:34am View
   
Are you asking us to test your code? You should write a couple of unit tests to validate your algorithm.
Tomas Takac 20-Apr-17 3:09am View
   
The code of the library is attached in the article, you are free to explore it. Also the author is more likely to give you an answer so you should ask in the article's forum.
Tomas Takac 20-Apr-17 3:03am View
   
I suspect this is the same problem as in your last question. Did you turn off the constraints, imported data and then tried to turn on the constrains again?

The problem is that you are putting some quality restrictions on your data such as foreign keys or non-null constrains but your data is just doesn't match. I would suggest you import all data into a staging table without any constraints, then validate it and only move the valid records to the live table. You can also produce a nice quality report for your users in the process.
Tomas Takac 19-Apr-17 9:31am View
   
Are you sure you have the voice installed?
Tomas Takac 19-Apr-17 4:06am View
   
You may want to read about referential integrity and foreign keys.
Tomas Takac 12-Apr-17 3:23am View
   
Can you explain what the problem is here?
Tomas Takac 12-Apr-17 3:19am View
   
You can either make it protected or set the field via the base class property (base.Cname).
Tomas Takac 11-Apr-17 4:29am View
   
Not sure how you are going to read from Day & Hour. Better store the size of the part you've already read and then scroll to that position next time. But this ever growing file is weird if you ask me. Maybe you should just copy it to a different location and import from there then let a new file be created in the original location - problem solved.
Tomas Takac 11-Apr-17 3:41am View
   
You approach is about right. Loading data into a staging table then I would use MERGE statement. But the text field is a problem. Alternatively you can store the position in the file when you read it first time, then next time scroll to that position and simply read from there.
Tomas Takac 10-Apr-17 14:59pm View
   
True, I updated the code.
Tomas Takac 10-Apr-17 3:36am View
   
Did you try regular expressions[^]?
Tomas Takac 9-Apr-17 6:12am View
   
So this is a runtime exception? On which line exactly is it thrown?
Tomas Takac 9-Apr-17 5:58am View
   
What error?
Tomas Takac 6-Apr-17 8:53am View
   
Try this: aRepeater.DataSource = cg.Values;
Tomas Takac 4-Apr-17 3:35am View
   
Yes, it is definitely possible, using schema tables. But it seems suspicious. Are you sure there is no other way? BTW put your current code in the "What I have tried" section.
Tomas Takac 31-Mar-17 9:46am View
   
If this is something to identify the batch then you should create a new table of batches, first insert there, get the id, then reference the batch form your table.
Tomas Takac 30-Mar-17 10:06am View
   
What exactly do you mean by "not working"?
Tomas Takac 30-Mar-17 3:42am View
   
Do not shout! Converted all text to lower case.
Tomas Takac 30-Mar-17 2:41am View
   
I don't think there is any. You need to learn how data access works in .NET from scratch.
http://stackoverflow.com/a/14932728
Tomas Takac 30-Mar-17 2:36am View
   
Did you read the documentation?
https://gcc.gnu.org/onlinedocs/gcc-6.3.0/gcc/Overall-Options.html#Overall-Options
Tomas Takac 29-Mar-17 2:46am View
   
Why do you need the repositories to be injected? What is the benefit? Maybe you are taking this too far. Just a thought.
Tomas Takac 28-Mar-17 6:36am View
   
It's a complete mystery to me why you are using AVG to calculate totals. In your picture the row which says "Total" doesn't show totals - at least not how I understand totals. So my advice would be: just use SUM and you'll be fine.
Tomas Takac 28-Mar-17 4:52am View
   
I'm sorry but I don't think I can help you. I suggest you add more details to your question (use Improve question to do that). You are asking a question about architecture so you should clearly explain your current architecture and the shortcomings thereof. You can also explain the improvement you have in mind and how it addresses the problem. But most importantly be clear about the problem at hand and your doubts about the current and proposed solution.
Tomas Takac 28-Mar-17 2:31am View
   
I'm afraid you need to explain more your deployment scenario. Why you need multiple services? How are you using scheduler with the services? Why is it so difficult to apply patches?
Tomas Takac 27-Mar-17 5:11am View
   
I guess you could create a SSIS package to do that. Or use xp_cmdshell.
Tomas Takac 25-Mar-17 8:36am View
   
I like that :)
Tomas Takac 23-Mar-17 10:11am View
   
You are creating a delegate to a instance method but not providing the instace. Found here: http://stackoverflow.com/questions/11120401/creating-delegate-from-methodinfo
Tomas Takac 22-Mar-17 7:57am View
   
What's wrong? Do you get an error? The results differ from expected?
Tomas Takac 22-Mar-17 4:24am View
   
+5, interesting, didn't know this, cheers!
Tomas Takac 22-Mar-17 3:49am View
   
Should work. What is the exact code in your Ex method?
Tomas Takac 22-Mar-17 3:44am View
   
You didn't say what's wrong with your code? Can you post the expected vs. actual results?
Tomas Takac 21-Mar-17 4:08am View
   
Tomas Takac 21-Mar-17 4:00am View
   
In order to use SqlBulkCopy you need to wrap the XML as IDataReader. AFAIK there is nothing like an XmlDataReader in the framework. You would need to write yourself or use a third party component.
Tomas Takac 14-Mar-17 12:49pm View
   
You may want to handle TaskScheduler.UnobservedTaskException too.
Tomas Takac 14-Mar-17 6:48am View
   
Are you sure that the error occurs at sqlCmd.ExecuteNonQuery() and not elsewhere? The exception comes from microsoft.visualbasic.dll and that's not where SqlCommand resides. Maybe it's the MsgBox function? Is this why you added the ToString() to there?
Tomas Takac 14-Mar-17 6:38am View
   
Look at solution #2. I think that solves your problem.
Tomas Takac 14-Mar-17 6:22am View
   
Why? What is your use case? I don't think you can do this from inside the add/remove accessors. If you have custom accessors the you can have a counter which you increment or decrement on add/remove. Or you can drop the custom accessors and get the count via GetInvocationList() anywhere inside your class. Depends on what you are trying to achieve.
Tomas Takac 14-Mar-17 5:09am View
   
Did you try to specify the machine name int the EventLog constructor[^] or via EventLog.MachineName property[^]?
Tomas Takac 10-Mar-17 2:38am View
   
No idea what you are doing. How about posting some of your code? Use Improve question and update the "What I have tried" field.
Tomas Takac 10-Mar-17 2:35am View
   
You are supposed to ask your teacher for help. We don't do your homework.
Tomas Takac 9-Mar-17 4:08am View
   
Just to be sure I added the dbo schema - check the updated solution.
Tomas Takac 9-Mar-17 3:55am View
   
Do you realize you didn't state your problem? What's wrong? Is there an error? Please note that we don't do homeworks around here. But if you have a valid programming question you should rephrase your question as such.
Tomas Takac 9-Mar-17 3:48am View
   
What about doing it in two steps? First read tblCampaignMaster.ID into a variable and then use that variable to update tblSMSSendData.SMSCAMPID.
Tomas Takac 8-Mar-17 14:29pm View
   
But if you run it in transaction and lock the table, or use serializable transactions, then I don't see any reason why it shouldn't. But maybe I'm missing something.
Tomas Takac 8-Mar-17 14:08pm View
   
I'm not sure what you mean. Whay it wouldn't work?
Tomas Takac 8-Mar-17 6:54am View
   
You basically repeated what's there in your question. In order to help you we need to know more. What's wrong with your code? Is there a compilation error? Is there a runtime error? Processes don't get killed?
Tomas Takac 8-Mar-17 6:50am View
   
It doesn't show where you are inserting into dbTable - that is your main problem right now, isn't it? Otherwise I'm right - you do have all the information necessary. You have the RFID from the reader, based on that you can find the employee who has this card assigned, then you can insert both into dbTable. You can now do this as two trips to database and optimize later.
Tomas Takac 8-Mar-17 4:34am View
   
Well the problem is that I don't see your problem. It sounds to me like you have all the data you need - just insert it. Maybe you should update your question and post some code where you read data from the card reader and then update the database. If you feel you explained yourself clear enough please just ignore me.
Tomas Takac 8-Mar-17 4:18am View
   
So you have RFID from the reader. Then lookup the EmpId from the EmpTable based on that RFID and insert both into your dbTable. I fail to see where is the catch. I was under the impression you are asking how to do this better as your approach is very naïve and things tend to get more complicated based on my experience. BTW you should really think about the way you name your tables and columns.
Tomas Takac 8-Mar-17 3:24am View
   
You can always join the two tables based on RFID when you need to. But maybe I don't fully understand your requirements.
Tomas Takac 8-Mar-17 3:06am View
   
I think you should not lookup the employee id each time the card is used. This is potentially performance critical so you want to push as much data through as possible. And I imagine this will be subject to optimization in future so you want to avoid hooking additional logic in there. Why do you need to have this information side by side? I guess for reporting. Then you should do this when you build the report not when user swipes the card.
Tomas Takac 8-Mar-17 2:59am View
   
You don't show the code related to what you are speaking about. You are supposed to post your code in the "What I have tried" field. Please use the Improve question button to do that.
Tomas Takac 8-Mar-17 2:51am View
   
I see two tables based on your description a table of employees, each employee has a card assigned. Then there is the table holding the records when (and possibly where) the card was swiped. I'm not sure though if I understand correctly what you are asking for.
Tomas Takac 8-Mar-17 2:46am View
   
You are supposed to put your SQL code in the "What I have tried" field. Use Improve question to do that.
Tomas Takac 8-Mar-17 2:32am View
   
What I would do is to create a table InvoiceNumbers(FiscalYear, CurrentInvoiceNumber). To get next invoice number you need to read the current invoice number from the table for the current fiscal year, increment it by 1 and then update the table with that new number. Please make sure this runs in a transaction and you place an update lock on the table while reading it. Then you are free to use this invoice number as you please.
Tomas Takac 7-Mar-17 2:40am View
   
You can pass the value into the UpdateDictionary method:
private void UpdateDictionary(string value, [CallerMemberName] string propertyname = null)
{
_diskDriveProperties[propertyname] = value;
}


Then call it like this:
UpdateDictionary(value);
Tomas Takac 7-Mar-17 2:34am View
   
As it seems there is not a one-to-one relationship between caseinformation and billing. You should investigate that instead trying to go around the problem using distinct or group by.
Tomas Takac 7-Mar-17 2:30am View
   
Would String.IsNullOrWhiteSpace Method[^] help perhaps?
Tomas Takac 6-Mar-17 10:23am View
   
Well as far as I can see SqlConnection con is never initialized. I guess you want to create a new connection using that connection string you are pulling from your app.config file. I think it should all be clear at this point.
Tomas Takac 6-Mar-17 8:36am View
   
You actually don't show how do you create the connection object itself. You just get the connection string and then use a con variable to create your command object. Maybe there is a problem there? BTW SqlConnection and SqlCommand are both disposable so you should enclose them in a using block.
Tomas Takac 6-Mar-17 7:09am View
   
Try group emp by emp.Field<int>("UserId") into g.
Tomas Takac 5-Mar-17 7:53am View
   
You should first find out which statement is failing.
Tomas Takac 17-Feb-17 9:20am View
   
So you want to exclude Col3 because there are all zeroes? Why? I'm asking that SQL is good at filtering data row-wise but not column-wise. I guess it can be done - just make sure it's worth the effort. Seems like a very odd requirement to me.
Tomas Takac 6-Feb-17 6:59am View
   
What exactly is your problem? Did you try to use BCP?
Tomas Takac 6-Feb-17 6:56am View
   
Why do you need to monitor something on client's computer from a web app? Sounds fishy.
Tomas Takac 21-Jan-17 9:37am View
   
What you want to do is not trivial. Basically you need to compare each group to all the others to find out if they match. I will give it a thought and maybe post an answer later. This might require some advanced features so I recommend you update tags of your question and specify the version of SQL Server you use.
Tomas Takac 20-Jan-17 5:05am View
   
You should consider storing data in a different way that would allow you to catch the reuse of components easily.
Tomas Takac 20-Jan-17 5:01am View
   
No sure what's the problem here but did you try:
SELECT * FROM policy WHERE policy_no BETWEEN 1 AND 100000
Tomas Takac 19-Jan-17 2:19am View
   
You should update your question and show us your code. It would be much easier then to understand the problem.
Tomas Takac 18-Jan-17 8:15am View
   
Are you talking about windows services or an arbitrary process?
Tomas Takac 18-Jan-17 3:15am View
   
Looks like homework to me.
Tomas Takac 15-Jan-17 8:37am View
   
And what exactly is the problem?
Tomas Takac 12-Jan-17 10:48am View
   
What exactly is your requirement? Chinese characters are not ASCII so "removing non-ascii characters" part works as intended. If you want to remove all characters that are not letters or numbers have a look at Char.IsLetterOrDigit method.
Tomas Takac 11-Jan-17 2:14am View
   
How exactly did you run the "2 instances" test and how did you measure those 140 seconds?
Tomas Takac 10-Jan-17 6:24am View
   
What is stopping you from passing the value to the method?
Tomas Takac 8-Jan-17 7:09am View
   
Tomas Takac 7-Jan-17 7:50am View
   
No idea what you are asking for. This is the output I get from your code, it's definitelly not empty:
-------------------------------
First Name | Last Name  |   Age
-------------------------------
Bill       | Gates      |    51
Edna       | Parker     |   114
Johnny     | Depp       |    44
-------------------------------
Tomas Takac 7-Jan-17 7:42am View
   
You should upload to a staging table. Let's say your table is named Patent, then create another table with the same structure and name it PatentStage (or use a different schema or whatever works for you). Always upload data to your staging table then reconcile it with your main table Patent. For example the MERGE statement in Transact-SQL[^] can help you with that.
Tomas Takac 25-Dec-16 15:01pm View
   
What is your data model? I guess there is an object representing your order. You need to create that when user starts shopping - there you use identity. After that you just reuse that object.
Tomas Takac 25-Dec-16 14:58pm View
   
You should not have an object with lists, rather you should have an class with 4 properties and then have a list of that.
Tomas Takac 25-Dec-16 14:55pm View
   
Do not use static variables, static is evil! You need to understand what the life-cycle of your objects is. When you are creating a new window then pass a new view model and populate it with your list. Also using two separate lists for something that is clearly one entity is bad. Create an other class to encapsulate userid and imgname. Overall my feeling is you are trying to tackle a problem that is too much for you. Nothing bad with that really but to be able to learn you need to break it down into smaller pieces.
Tomas Takac 24-Dec-16 15:47pm View
   
What do you mean by "not working"? Anyway this is not the way you should do validations.
Tomas Takac 23-Dec-16 7:23am View
   
You are on the right track, the dot notation is a good idea. Now you just need to refactor UpdateValues a bit and call it recursively.
Tomas Takac 23-Dec-16 5:06am View
   
I don't quite follow but when you are adding a new column to a table then it either has to allow nulls or have a default value specified.
Tomas Takac 21-Dec-16 8:27am View
   
You need to have a look at the query plan. Analyze it to pin down the problematic parts of your query. I doubt you will get a more specific answer than this one. Please note that the performance also depends on the structure of your tables and related indexes none of which you are showing in your post.
Tomas Takac 21-Dec-16 6:34am View
   
You need to use the "Reply" button otherwise the user won't be notified of your comment.
Tomas Takac 21-Dec-16 6:32am View
   
I guess you need to google harder. Look what I found within few seconds: sql server - Generate SQL Create Scripts for existing tables with Query - Stack Overflow[^]
Tomas Takac 17-Dec-16 2:26am View
   
Can you give some examples of formulas you want to store?
Tomas Takac 7-Dec-16 6:45am View
   
Each row should have an unique id. You need to know which row is new and which was updated. Let's say all new rows will have id=0, while edited rows will have id>0. Based on that you either issue an INSERT or UPDATE command.
Tomas Takac 4-Dec-16 5:12am View
   
It would be helpful to know how do you generate these invoice numbers in the first place. Please update your question with the relevant code.
Tomas Takac 4-Dec-16 5:04am View
   
I'm confused. So you solved it with this additional join but you don't like the solution? So what did you try to solve it in your application layer?
Tomas Takac 3-Dec-16 8:17am View
   
What kind of id? You can use NEWID function[^] to create a GUID.
Tomas Takac 30-Nov-16 2:23am View
   
Clearly it's the last join to Tbl_Dispatch_VendorToClient_Details that is causing you problems. You need to analyze the data to find out why.
Tomas Takac 29-Nov-16 9:33am View
   
I fail to see why you cannot create a foreign key, could you please elaborate?
Tomas Takac 28-Nov-16 10:16am View
   
In the first table you have leaves aggregated for all employees. There is no way you can break it back to employee level, not without more information anyway. I would suggest you store data as in EmployeeLeavesList then you can easily generate Leavesperyear from that.
Tomas Takac 16-Nov-16 3:39am View
   
I don't see why not. Can you post some code? "It doesn't work" doesn't tell us much.
Tomas Takac 15-Nov-16 6:07am View
   
You need to use the "Reply" button otherwise the user won't get notified of your comment.
Tomas Takac 14-Nov-16 5:15am View
   
What exactly is your problem? What is the output you get? And how does it differ from what you expect? I believe this is your output:
This is an override function
Actual function in parent class
Tomas Takac 11-Nov-16 6:24am View
   
As F-ES said, set the batch size to an appropriate value. See my edit.
Tomas Takac 11-Nov-16 2:50am View
   
No, you don't need to load it all into memory. SqlBulkCopy can use a data reader.[^]
Tomas Takac 11-Nov-16 2:47am View
   
Do you care to explain how the information is encoded? Seems like the blue component is the unicode value of the character. But I don't get the extra step with ASCII encoding - what is it good for?
Tomas Takac 11-Nov-16 2:38am View
   
The data is just too big, you cannot load it all into memory. Why do you need to do that in the first place?
Tomas Takac 10-Nov-16 4:11am View
   
I guess the error message is clear. You need to know the password to unzip.
Tomas Takac 8-Nov-16 2:23am View
   
Please do not repost. You've got an answer in your previous question[^].
Tomas Takac 7-Nov-16 3:30am View
   
Do not use strings like that. Create your own classes to hold the information you need. For example have a class named Student which will have a string property Name and a collection of Grades.
Tomas Takac 1-Nov-16 8:38am View
   
Did you try what was recommended in the SO question? What is your query? What is the result? Do you get an error?

SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='YourTableName'
Tomas Takac 19-Oct-16 5:39am View
   
Multiplication and divisions with numeric/decimal can be tricky because of the scale & precision alignments. I don't have time to give you a proper answer right now but what you can try is to convert to FLOAT do the calc then convert back to numeric.
Tomas Takac 16-Oct-16 15:53pm View
   
which database engine? which version? what error message?
Tomas Takac 14-Oct-16 2:37am View
   
Do you have any possibility to change how the data is stored? Because right now it doesn't make any sense to store data per day while you manage and report it by fortnight. Also you should post your code (via Improve question).
Tomas Takac 5-Oct-16 14:10pm View
   
That is your default constraint, I just added a name to it. A default constraint, as the name suggests, provides a default value in case you don't specify value for that column during insert. Maybe you are looking for a CHECK constraint? Read the documentation for CREATE TABLE (Transact-SQL)[^].
Tomas Takac 5-Oct-16 2:53am View
   
What is the error message you get? You cannot create primary and foreign keys like that.
Tomas Takac 14-Sep-16 10:20am View
   
Show what you have tried. Otherwise there is nothing to talk about.
Tomas Takac 8-Sep-16 10:39am View
   
If you have this, then it should be juts a matter of rewriting those fancy running sums. That's the boring part.
Tomas Takac 7-Sep-16 2:27am View
   
What is the role of the second table? How do you calculate value?
Tomas Takac 4-Sep-16 3:30am View
   
I don't understand. You clearly are able to split the strings. So what is the problem?
Tomas Takac 2-Sep-16 6:02am View
   
I'm afraid you have to add more context. For example how does you example relate to the GetConfig method?
Tomas Takac 1-Sep-16 2:31am View
   
ppolymorphe is right, try it yourself. This is simple math. The former case obviously works, the later gives you a negative number. Think about how to get the correct value from that.
Tomas Takac 30-Aug-16 4:55am View
   
What's the problem with your code? Few comments though:
1) Use using Statement[^] with disposable objects.
2) You can use ExecuteScalar Method[^] when you are retrieving a single value from the database.
3) Consider loading all the flags and process the whole list at once.
Tomas Takac 30-Aug-16 4:27am View
   
Not clear, you want a Cartesian product of the two lists? Or you want to join them by some key?
Tomas Takac 10-Aug-16 5:34am View
   
In your example there is difference in refno between table A and B. Second "ORDER BY (SELECT 1)" looks highly suspicious - you should use a real column, perhaps some datetime field. Finally I don't understand how this should work. You are inserting from A to B and generating the InvoiceNo. But what happen with the records in A, do they get deleted and next time you are only inserting the newly added records since last run? Or A and B have the same date, except of the InvoiceNo of course?
Tomas Takac 10-Aug-16 2:50am View
   
Check SQL server logs, there may be more information than in the error message.
Tomas Takac 9-Aug-16 2:52am View
   
If I have different produdcts:
A (Name, Type)
B (Name, Type, ExpDate)
C (Name, Type, Color)
then I can create the tables like this:
Product (id, name, type)
ProductB (id, expdate)
ProductC (id, color)
Or alternativelly I can have only one table:
Product (id, name, type, expdate nullable, color nullable)
The choice is yours. That is what i tried to tell you in my first comment.
Tomas Takac 9-Aug-16 2:46am View
   
Please do not re-post the same question again. You are supposed to improve your original queston[^]. There are some comments there you didn't answer and you didn't really add more details here. This can be considered rude and you sure don't want to offend people that are trying to help you.
Tomas Takac 8-Aug-16 13:58pm View
   
You said that some products have expired date and some don't. Common attributes would be those that are shared by all the product types like name for example. On the contrary expiry date would only by applicable to some of them.
Tomas Takac 8-Aug-16 3:27am View
   
You can either stuff it all in one table where the optional columns will be nullable or have a table with common attributes and a separate table per product type with specific attributes. If you are familiar with object modelling try to look up "table per hierarchy" and "table per type" - it's about mapping object hierarchies to tables.
Tomas Takac 5-Aug-16 9:33am View
   
If you have spare time and are willing to work why not work on a real project? And maybe earn some money along the road? Look at https://www.freelancer.co.uk/ for example.