16,004,557 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Sascha Lefèvre (Top 200 by date)
Sascha Lefèvre
23-Nov-17 19:31pm
View
Do you mean that your messages appear with a text like "This message has been flagged as potential spam and is awaiting moderation" instead of your actual message? That's the automated spam filter of this site and at that point it doesn't mean anything but that a moderator will have to take a look at it and then decide whether it actually is spam or not. In the latter case your message will then be shown as you wrote it. I don't know how the automated spam filter exactly works but it looks like messages from members who haven't posted many messages yet are more likely to get flagged as spam. If this is what happens to you / to your messages: You're doing nothing wrong (as long as your messages actually aren't spam ;-) ) and it should get less frequent at some point - no need to worry.
Sascha Lefèvre
22-Nov-17 4:38am
View
Please don't post questions as solutions - use the button "Have a Question or Comment?" below the question instead.
Sascha Lefèvre
26-Oct-17 10:00am
View
Process.Start(@"C:\PROGRA~1\My App 4\Compare\app.exe"); will work regardless of spaces. Spaces are only a problem in your code because you use the path as an
argument
. Enclose it in double quotes, as I said and as Dave showed below.
Sascha Lefèvre
14-Oct-17 13:56pm
View
Have you tried inserting records into the tables with relations? As long as you don't have circular dependencies it's pretty straight forward - the only special thing to keep in mind is to insert records that are being referenced by others first.
Sascha Lefèvre
26-May-16 12:32pm
View
+5
Sascha Lefèvre
29-Apr-16 9:42am
View
Thank you, Bill. Yes, you're right there, I should've mentioned that. But according to macika's comment it worked out; most probably because there's in fact a different class implementing IService :)
Sascha Lefèvre
28-Apr-16 19:09pm
View
>
"Note that the lack of parameters in Get() suggests that you should rather have some property doing the same stuff."
I'm not sure whether I got this from the Microsoft C# style guide or from somewehere else: Properties should return rather quickly, for heavier computation methods should be used. As it's basically irrelevant if there's a getter-only property or a method (if databinding isn't a goal) I think this is an intuitive design guideline.
>
"presence of structural exception handling eliminates difference between just invalid parameters and parameters causing exception."
I don't quite get it - can you please elaborate?
Sascha
Sascha Lefèvre
28-Apr-16 18:59pm
View
I agree that throwing an InvalidOpEx wouldn't add a whole lot of value but, (as it appears to be an API implementation) it would allow to provide a to-the-point error description, as a NullRefEx from within an API-method is somewhat unexpected, IMO.
But, actually, I'm currently implementing an IDataReader-class and asking myself if I really should check all the required conditions within the GetXXX(..)-methods, as it will certainly noticeably impact performance and an exception will be thrown for most fault-cases anyway along the way (array-bounds etc.), just not very descriptive. So I can see how it can be a design-consideration whether or not to do it, but if performance isn't a concern I would always do it for clarity.
Sascha
Sascha Lefèvre
28-Apr-16 18:39pm
View
You're welcome! :)
Sascha Lefèvre
28-Apr-16 10:31am
View
"but i get an error"
- please tell us the error message.
Sascha Lefèvre
27-Apr-16 15:44pm
View
For Azure-SQL the documentation says
"The CREATE DATABASE statement must be the only statement in a Transact-SQL batch."
I'm pretty sure that the same is valid for SQL-Server and they just didn't include it in the documentation. And
"only statement in a batch"
means that you can't execute them at once.
Sascha Lefèvre
27-Apr-16 15:28pm
View
5ed
Sascha Lefèvre
27-Apr-16 15:22pm
View
Answer updated, please take a look.
Sascha Lefèvre
27-Apr-16 15:09pm
View
After I wrote the answer I became unsure myself and was just about to test it - I assume that the two statements can't be "batched" - so you would have to execute them separately. I'll update the answer after I tested it.
Sascha Lefèvre
27-Apr-16 7:10am
View
Thank you, Bill!
Sascha Lefèvre
26-Apr-16 11:17am
View
Thank you, Sergey.
Sascha Lefèvre
22-Apr-16 14:23pm
View
Since you marked the solution as accepted, have you found the cause?
Sascha Lefèvre
22-Apr-16 13:42pm
View
That's just telling Ben that I've upvoted his solution :)
Sascha Lefèvre
22-Apr-16 13:40pm
View
Don't guess :) Either run your application in debug mode and inspect the lengths of the strings or log the string/lengths to some output.
Sascha Lefèvre
22-Apr-16 13:35pm
View
It also applies to text-columns - in this case I see no other explanation than that you're attempting to store a string with a length > 50 characters.
Sascha Lefèvre
22-Apr-16 13:34pm
View
5ed
Sascha Lefèvre
22-Apr-16 13:34pm
View
In this case it's perfectly ok from my point of view - he now knows everything required to solve this problem.
Sascha Lefèvre
22-Apr-16 13:29pm
View
You could post this as a solution :)
Sascha Lefèvre
15-Apr-16 17:47pm
View
+5
Sascha Lefèvre
15-Apr-16 17:47pm
View
+5
Sascha Lefèvre
12-Apr-16 9:50am
View
Judging from the MSDN doc for the ReadXml-method (
see here
) you should use
System.Data.XmlReadMode.ReadSchema
instead of
System.Data.XmlReadMode.Auto
.
Also, I assume that you should remove the
reader.Read();
line.
Sascha Lefèvre
8-Apr-16 5:09am
View
This isn't a question, it's a brazen request. And the answer is no.
Sascha Lefèvre
5-Apr-16 17:00pm
View
You're welcome!
Sascha Lefèvre
4-Apr-16 9:10am
View
Please don't repost.
If you want to update your
previous question
use the "Improve question" link below it.
Sascha Lefèvre
2-Apr-16 11:50am
View
+5
Sascha Lefèvre
2-Apr-16 9:10am
View
Indeed! Fixed, thank you :)
Sascha Lefèvre
2-Apr-16 9:01am
View
Don't cross-post.
You already got an answer to your question here:
Input string was not in a correct format as output in c# console application - C# Discussion Boards - CodeProject
[
^
]
If you don't understand how to follow the instructions in the answer, reply to it and ask for clarification.
Sascha Lefèvre
1-Apr-16 12:25pm
View
Please use the "Have a Question or Comment?"-button below a solution to post a comment to that solution. Please delete this solution because it is none :)
What you are asking for here (not repeating rows) is simply done with a for-loop that does not increment by 1 but by 3.
Sascha Lefèvre
1-Apr-16 11:06am
View
5ed
Sascha Lefèvre
31-Mar-16 19:09pm
View
Thank you, Sergey.
Sascha Lefèvre
31-Mar-16 18:15pm
View
You're welcome! Good luck! :-)
Sascha Lefèvre
31-Mar-16 18:00pm
View
Please use the button "Have a Question or Comment" below a solution to leave a comment to that solution. Please delete this solution, because it is none :-)
I just edited my solution another time because I spotted two more compiler issues, please take a look. I would be grateful if you mark my solution as an accepted solution as well (you can mark multiple as accepted) :-)
Sascha Lefèvre
31-Mar-16 17:49pm
View
+5
Sascha Lefèvre
31-Mar-16 17:47pm
View
5ed
Sascha Lefèvre
31-Mar-16 17:30pm
View
I spotted it after I submitted my solution ;-)
Sascha Lefèvre
31-Mar-16 14:40pm
View
I found it - but it's actually only true for value types:
http://stackoverflow.com/questions/1583050/performance-surprise-with-as-and-nullable-types
Sascha
Sascha Lefèvre
31-Mar-16 13:20pm
View
5ed
>
Such dynamic casting is better to do in one shot
I somewhere read (IIRC from a trustworthy source) that
as
is slower than a combination of
is
and a cast. If you're interested I'll try to dig it up.
Sascha Lefèvre
30-Mar-16 6:42am
View
LinqToSql is the ORM-technology that preceded EF (I've never used it so I can't tell you the exact differences). It's deprecated by now, AFAIK. I assume you used LinqToSql synonymously with EntitySql.
Could it be that the proper name for the subject you're asking about is "polymorphic associations"? E.g. a base-entity A0 with sub-entities A1 and A2 and from an entity X you want to reference with a single property either an entity A1 or A2?
If that's not what you're asking about I would need some clarification :)
Sascha Lefèvre
30-Mar-16 5:30am
View
Hehe :)
Alright - to get back to your question, I'm a bit confused why you mention both EF
and
LinqToSql?
Sascha Lefèvre
29-Mar-16 16:09pm
View
5ed
Sascha Lefèvre
29-Mar-16 12:23pm
View
I'm doing something very similar, if not the same, but in code. Wouldn't that work for you as well? In code it's completely safe from being messed up :)
Sascha Lefèvre
29-Mar-16 10:39am
View
Did you look into the exception details / inner exception?
Sascha Lefèvre
28-Mar-16 11:38am
View
SQL CE is "in deprecation state". Meaning that there will be no new versions and support will end within the next few years. For new projects that should be maintained for several years it's probably not a good choice (any more).
Sascha Lefèvre
28-Mar-16 11:36am
View
Not clear enough.
Sascha Lefèvre
28-Mar-16 5:54am
View
Sort of - extension methods are called on class instances (variables):
https://msdn.microsoft.com/en-us/library/bb383977.aspx
Sascha Lefèvre
28-Mar-16 4:25am
View
+5
Sascha Lefèvre
28-Mar-16 4:00am
View
Thank you, Sergey.
Sascha Lefèvre
27-Mar-16 18:08pm
View
You're welcome! :-)
Sorry for the syntax mistake, VB.NET isn't my language of choice ;-)
I added a clarification to my answer above, please take a look.
cheers, Sascha
Sascha Lefèvre
27-Mar-16 11:36am
View
Thank you, Bill! Let's hope so :)
cheers, Sascha
Sascha Lefèvre
27-Mar-16 10:12am
View
;-)
You're welcome!
Sascha Lefèvre
27-Mar-16 3:52am
View
Thank you, Sergey :)
Sascha Lefèvre
27-Mar-16 3:51am
View
No, I won't do that. Because it would
not
be helpful for you. You may think it would be helpful but the truth is: If you don't start trying to do this yourself you will never be able to.
Sascha Lefèvre
26-Mar-16 21:14pm
View
Thank you, Garth!
Sascha Lefèvre
26-Mar-16 20:36pm
View
As you never call add.Show() I can only assume the TextBox that remains empty isn't the TextBox that you think it is.
Sascha Lefèvre
26-Mar-16 19:14pm
View
Hehe :-)
Of course you have my understanding, Sergey. Thank you very much for adding what you had available. I'll take a look at it!
Sascha
Sascha Lefèvre
26-Mar-16 15:54pm
View
My 5.
Sergey, I read somewhere that you keep a database of your past answers and I assume you have categorized them somehow by topic. May I ask you to give me a list of links to your answers on character sets, encodings and "related stuff"? I need to improve my knowledge in this area too.. :)
Sascha Lefèvre
26-Mar-16 13:42pm
View
The DataGridViewCellEventArgs-argument "e" gives you the index of the row that was just left (e.RowIndex). With that index you need to figure out if that row is a new one. The trouble here is: When the RowLeave-event occurs, the row just isn't the new row any more. So you're "a bit late", so to say. You have two options:
Option 1: Add a boolean variable with a name like "CurrentRowIsNew" as a class-variable. Add an eventhandler-method for the event RowEnter. In that method set CurrentRowIsNew equal to e.IsNewRow. Now when the RowLeave-eventhandler-method gets called you can check if CurrentRowIsNew is true and then execute the insert-code (and set CurrentRowIsNew to false).
Sidenote: The CellValueChanged-event also occurs for new rows so your update-code gets called multiple times
before
the new row gets actually inserted into the database. If you check CurrentRowIsNew there too, you can execute the update-code only if CurrentRowIsNew is false.
Option 2: This would be the better option but require more changes. I wouldn't recommend using the DataGridView as the source for the values of your database-code. The DataGridView is intended as... a view. Not as a DataTable. Therefore a DataGridView's methods are designed for the visualization of data but not for handling the state of data. For that a DataTable is better. I assume your select-code fills a DataTable and sets that DataTable as the DataSource of your DataGridView. You could keep the reference to that DataTable as a class-variable. And the DataRow of the DataTable would tell you if it's a new row until you've saved it to the database, regardless whether the input cursor is still in that row or not.
Sascha Lefèvre
26-Mar-16 12:14pm
View
Yep, when I saw your previous question I expected that: You missed one earlier suggestion from me. In dataGridView1_RowLeave you need to check if that row which was just left was a new row and only then execute the insert-code.
Sascha Lefèvre
26-Mar-16 10:38am
View
Actually we're getting closer :)
But one thing I could have seen earlier: You're using else-if-statements for initializing the parameter-values from the datagridview. That makes no sense because it means that only one of those values will be set. You need to change all those to "independent" if-statements.
Sascha Lefèvre
26-Mar-16 9:38am
View
Change this:
cmd.Parameters.AddWithValue("@AccountNumber", accountnumber);
cmd.Parameters.AddWithValue("@Account", Account);
cmd.Parameters.AddWithValue("@Date", Date);
cmd.Parameters.AddWithValue("@Description", Description);
cmd.Parameters.AddWithValue("@Post_Ref", Post_ref);
cmd.Parameters.AddWithValue("@Debit", Debit);
cmd.Parameters.AddWithValue("@Credit", Credit);
cmd.Parameters.AddWithValue("@Balance", Balance);
to this:
cmd.Parameters.AddWithValue("@Account", Account);
cmd.Parameters.AddWithValue("@Date", Date);
cmd.Parameters.AddWithValue("@Description", Description);
cmd.Parameters.AddWithValue("@Post_Ref", Post_ref);
cmd.Parameters.AddWithValue("@Debit", Debit);
cmd.Parameters.AddWithValue("@Credit", Credit);
cmd.Parameters.AddWithValue("@Balance", Balance);
cmd.Parameters.AddWithValue("@AccountNumber", accountnumber);
Sascha Lefèvre
26-Mar-16 7:29am
View
Please try this: Move this line:
cmd.Parameters.AddWithValue("@AccountNumber", accountnumber);
below the line for
@Balance
.
Sascha Lefèvre
26-Mar-16 6:48am
View
I've never worked with gcc; don't know if there's a graphical debugger available. If you have a Windows PC then you could use Visual Studio instead:
https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx
Sascha Lefèvre
25-Mar-16 17:53pm
View
Have you tested your update-code independently from the CellValueChanged-event? If not: Place a new Button on your Form, create an eventhandler-method for its Click-event and copy the code from dataGridView1_CellValueChanged into that method. Modify the parameter-creation-code so that it doesn't take the values from the DataGridView but instead write some hard-coded values there (just for testing). Make sure that you use an AccountNumber of an already existing record. Then run your program, click that test-button and see if 1) it works without throwing an exception and 2) if the record with that AccountNumber got updated. Then you'll at least know that that part works on its own.
Sascha Lefèvre
25-Mar-16 16:57pm
View
It's not possible that an update statement creates a new record instead of updating one. Provided that your observation is correct, the only explanation would be that not the update statement but the insert statement gets executed somehow. I assume you didn't attempt to debug your code using the debugger. You should do that. For a programmer, a debugger is like a microscope for a biologist: It allows you to see what happens. Jump into it, learn how to use it and you will be able to solve a lot of problems yourself! Take a look here:
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide
Ultra short version: Place debug brakepoints at the start of your methods that are of interest, start debugging with F5, then step through the execution of your code with F10, observe the control flow and values of variables and compare that to what you think it should be. When it starts to differ from what you think it should be you've probably found the origin of the problem.
Sascha Lefèvre
25-Mar-16 10:41am
View
Thank you, Sergey.
Sascha Lefèvre
24-Mar-16 22:22pm
View
I had a hunch it was that one :) I'll write up a small solution.
Sascha Lefèvre
24-Mar-16 20:25pm
View
My 5
Sascha Lefèvre
24-Mar-16 20:23pm
View
Thanks, Sergey!
Sascha Lefèvre
24-Mar-16 20:19pm
View
Well, you definitely had your pen ready :) +5
Sascha Lefèvre
24-Mar-16 18:10pm
View
You're welcome! :)
Sascha Lefèvre
24-Mar-16 17:15pm
View
Thanks, Bill!
Sascha Lefèvre
24-Mar-16 16:42pm
View
Did you check if System.Data.SQLite.dll has dependencies and if so, included them in the setup?
Sascha Lefèvre
24-Mar-16 15:22pm
View
You're welcome! ;-)
Sascha Lefèvre
24-Mar-16 15:03pm
View
That's the definition of the if-statement.
Sascha Lefèvre
24-Mar-16 14:09pm
View
How to create code? By writing it! It's
YOUR
final year project. Come back if you have a
specific
question
while
writing your code. But we won't do your work for you, thank you very much.
Sascha Lefèvre
24-Mar-16 13:37pm
View
I'm curious: Why do you do this in the database?
Sascha Lefèvre
24-Mar-16 12:38pm
View
My 5. Maybe even too polite..
Sascha Lefèvre
24-Mar-16 11:43am
View
Take a look at the articles I linked for you. Do it. Just do it. Please.
Sascha Lefèvre
24-Mar-16 11:36am
View
No. For two reasons:
1) As I wrote in my answer above,
you should never
store passwords as plain text or send them via email. Passwords are supposed to be secure. Email is
not
secure. I will not support this practice.
2) That query would be very, very basic. If you started an EF-project you should be able to do that yourself. Otherwise you will ask for every other query that someone else write it for you as well. Take a look at the various online EF-tutorials if you need to learn about EF-queries.
Sascha Lefèvre
24-Mar-16 11:14am
View
Why do you use an SqlConnection and all that other Sql**** stuff if this is an EntityFramework project?
Sascha Lefèvre
24-Mar-16 11:05am
View
What I meant: In your app.config you have something like this:
<connectionStrings>
<add name="userEntities2" providerName="System.Data.SqlClient" connectionString="
XXX
"/>
</connectionStrings>
What's in place of
XXX
in your app.config?
Sascha Lefèvre
24-Mar-16 10:54am
View
Does the connection string in your app.config actually have a value?
Sascha Lefèvre
24-Mar-16 9:49am
View
I have no idea what could be going wrong there.. but it's kind of interesting. If you like, zip your project, upload it to some file-sharing site (dropbox or something), share the download-link here and I'll take a look at it.
Sascha Lefèvre
24-Mar-16 9:31am
View
Show the relevant part of your web.config
(Use the
Improve Question
link below your question to add it to your question)
Sascha Lefèvre
24-Mar-16 9:11am
View
Let's continue our discussion up here.
>>
For example BOOK is linked to OPTIONS via the CONTRACT field. If one of the records in BOOK has a value of ABC123 for CONTRACT, and only one record in OPTIONS has a value of ABC123 for CONTRACT then a query should produce a record with all BOOK fields and all OPTIONS fields where BOOK.CONTRACT==OPTIONS.CONTRACT
I don't think you actually need this but, just for illustration, that would be:
from B in DATActx.BOOKs
join O in DATActx.OPTIONs on B.CONTRACT equals O.CONTRACT
select new { B, O };
Or the select clause like this instead:
select new {
Contract = B.CONTRACT,
BookID = B.ID,
BookDeal = B.DEAL,
...
OptionID = O.ID,
OptionExchange = O.OPT_EXCHANGE,
...
};
>>
I should make OPTIONS.CONTRACT the primary key (and its linked to BOOK.CONTRACT in a one to many)
So one OPTION can have multiple BOOKs? In that case I have to apologize, I could have seen this earlier from your diagram but I got mislead by the name of the property "OPTIONs" of BOOK: If it's a single reference (foreign key) to one OPTION (or null) then you shouldn't use plural there (and the same goes for OPTION.SKEWs, name it SKEW instead.)
>>
[..] but BOOK has nulls and this raised an error
Is there a table in which CONTRACT is unique and non-nullable? Your diagram looks like it
might
be the table SKEW. Then you could make CONTRACT the primary key there. And then I would remove CONTRACT from BOOK because it can be retrieved from OPTION, if there is one, and if there is no OPTION for a book it probably has no CONTRACT anyway, right? That would be database normalization (don't duplicate information), which sometimes is beneficial to ignore but you should have a good reason for it.
Does the following query work? If yes, I would assume it's the solution to your question:
var qryBOOK =
from B in DATActx.BOOKs where B.DEAL == 1
select new clsTRADER()
{
P_C = B.P_C,
STRIKE = B.STRIKE,
OPT_EXP = B.OPTION
s
.OPT_EXPIRY,
OPT_MULT = B.OPTION
s
.OPT_MULTIPLIER,
SKEW_A = B.OPTION
s
.SKEW
s
.SKEW_A
};
Sascha Lefèvre
24-Mar-16 9:09am
View
Deleted
(formatting test comment)
Sascha Lefèvre
24-Mar-16 9:07am
View
Take a look at the search results here:
https://www.google.com/search?q=c%23+watermark+video&ie=utf-8&oe=utf-8
Sascha Lefèvre
24-Mar-16 8:35am
View
What Richard is saying that it's irrelevant what type of file you want to encrypt. Encrypting a video is not different from encrypting audio or text or whatever.
Sascha Lefèvre
23-Mar-16 18:21pm
View
Thank you Sergey, my 5 for you as well. Forgot about those methods ;)
Sascha Lefèvre
23-Mar-16 18:19pm
View
Didn't think of that! My 5
Sascha Lefèvre
23-Mar-16 11:20am
View
Please use the reply-button at the top of my comment here if you want to notify me of further additions to your question. (I don't get a notification if you use that "Have a Question of Comment"-button below.)
Sascha Lefèvre
23-Mar-16 10:44am
View
Please use the button "Have a Question or Comment" below my solution if you want me to get notified of your comment, I just saw this by chance.
Please run your program in debug mode and observe which line the exception message window is pointing to and tell me.
Sascha Lefèvre
23-Mar-16 8:46am
View
No, it's not clear enough yet :)
You have multiple "Options" for each "Book". And you want to select the value "OPT_EXPIRY" of one of the options assigned to the book. You have to tell which one of these options should be taken for that. E.g. (made up):
OPT_EXP = B.OPTIONs.Single(option => option.SYMBOL == "blah").OPT_EXPIRY
Which would mean: There's a single option with a SYMBOL value of "blah". Take the property OPT_EXPIRY of that one and assign its value to OPT_EXP (of clsTRADER).
And then for the "Skews": A book has (potentially) multiple "Options" and one of those options has (potentially) multple skews. You need to phrase a predicate of which exact skew to select for accessing its property SKEW_A.
Sascha Lefèvre
23-Mar-16 8:13am
View
(because your predicates in those "Single(..)"-expressions don't show it well because they're syntactically not correct)
Sascha Lefèvre
23-Mar-16 8:11am
View
Please also include an explanation of what to select into your question, explained in natural language.
Sascha Lefèvre
23-Mar-16 7:46am
View
Garth, using navigation properties is endorsed for EF (I assume that's what it is) and AFAIK (not being an EF-expert) if there are no explicit association-entities there's also no way to use a regular linq-join instead.
Sascha Lefèvre
23-Mar-16 7:43am
View
It's certainly possible. But in order to show you it's essential to know a) the model and b) your predicates for what to select (best explain them in normal language).
Sascha Lefèvre
23-Mar-16 7:40am
View
You could upload an image to e.g. imgur.com and then include the link to that in your question.
Sascha Lefèvre
22-Mar-16 9:56am
View
+5Typo in the last line
Sascha Lefèvre
22-Mar-16 5:47am
View
While ElseIf's are a good thing to suggest of course, it's not the actual problem. The actual problem is that the inquirer apparently thinks that
IsNot
would be the counterpart to =
Instead it's checking for referential equality.
Sascha Lefèvre
22-Mar-16 5:37am
View
if/if-else is not a loop! If you're looking for a word how to call it: statement
Sascha Lefèvre
21-Mar-16 20:18pm
View
If you didn't observe yet where the exception is being thrown, run it again and when the exception occurs, look at which line it is. Then set a debug breakpoint on that line or at the start of that method and run it again. Observe the values of all variables / contents of the DataSet / etc. while you step through the execution line by line and compare that to your expectation of what it should be. Then "go backwards" with breakpoints if neccessary to find the first line where things differ from what you intended. If you then still need help edit your question (with the "Improve question" link below the quesion) and explain what's going wrong and
where
.
Sascha Lefèvre
21-Mar-16 14:43pm
View
This forum is titled "Quick Answers" - your question really doesn't suit that. There are so many tutorials on this topic, here on CodeProject and elsewhere on the web. Google it and read some of them.
Sascha Lefèvre
21-Mar-16 12:21pm
View
You're welcome! :)
Sascha Lefèvre
21-Mar-16 9:34am
View
Double-click on the first error that you've shown here and take a look at the code. You obviously attempt to provide a string where some method expects a generic list (of a type that I don't know because the error message doesn't tell).
Also: In your test case the declaration of the SqlParameter appears to be completely unneccessary. But what I just spotted there: Is @Booknum supposed to be an integer (because you use SqlDbType.Int there)? Then you might want to change
string Booknum
in your Index-method to
int Booknum
.
Sascha Lefèvre
21-Mar-16 8:21am
View
Which error do you get if you declare it like this?:
public void Index(string indexDir, string connstring, string sproc, string Booknum)
Sascha Lefèvre
20-Mar-16 8:17am
View
"
not working
" generally isn't a good explanation of a problem. Do you get an exception? Or is simply nothing happening?
Sascha Lefèvre
20-Mar-16 7:05am
View
Also, you attempt to assign a string to the array indices of
array
but
array
is of type
one
so you would have to assign instances of
one
to it. Which is unneccessary because it already contains (uninitialized) instances. Instead you might want to set the members of the instances of each array index.
Sascha Lefèvre
20-Mar-16 7:02am
View
You attempt to use the operator << with your "whole" class
one
but there is no operator defined for that. You could either use the operators defined for standard types by sending the members of class
one
one after another to the output stream or define ("overload") the << operator for your class
one
.
Sascha Lefèvre
19-Mar-16 6:27am
View
It's
not
about the negative sign!
It's about the decimal separator and you
already did get a solution
for that. Read it, try to understand it and ask for clarification with a comment to it if you don't understand it. And stop posting the same question over and over.
Sascha Lefèvre
19-Mar-16 4:29am
View
Of which type is the array S3?
Sascha Lefèvre
18-Mar-16 6:40am
View
Please take a look at the numerous articles here on CodeProject describing database connectivity.
Sascha Lefèvre
18-Mar-16 6:10am
View
Alright - thank you for the reply :)
Sascha Lefèvre
17-Mar-16 16:11pm
View
Thanks, Bill!
Sascha Lefèvre
17-Mar-16 13:32pm
View
;-)
You're welcome!
Sascha Lefèvre
17-Mar-16 13:01pm
View
You're welcome! :)
Sascha Lefèvre
17-Mar-16 12:41pm
View
Time to call it a day I guess - thanks again :)
Sascha Lefèvre
17-Mar-16 12:22pm
View
Why would you want to do that? Is your login assembly that large that you need to conserve memory?
Sascha Lefèvre
17-Mar-16 12:18pm
View
Typing didn't keep up with neural input ;) Thanks, Richard.
Sascha Lefèvre
17-Mar-16 10:33am
View
Did you downvote my answer? If so, I'd be interested to know why?
Sascha Lefèvre
17-Mar-16 9:46am
View
Did you take a look at my solution?
Sascha Lefèvre
17-Mar-16 8:48am
View
We don't send code.
Sascha Lefèvre
17-Mar-16 7:42am
View
I don't think it is a solution because it's not answering his question whether his methods are thread safe or not..
Sascha Lefèvre
17-Mar-16 7:35am
View
Isn't this line a bug/typo?:
context.Users.Add(mail);
Sascha Lefèvre
17-Mar-16 6:46am
View
So is portfolioID an int-array or a single int (or something different)?
Sascha Lefèvre
17-Mar-16 6:05am
View
The inquirer is asking
whether the above is thread safe or not
. Saying
he might need to use locking
is no answer to that.
Sascha Lefèvre
17-Mar-16 6:04am
View
Why would you use a lock here?
Sascha Lefèvre
17-Mar-16 6:01am
View
It's not a static instance of a class, it's a static class.
Sascha Lefèvre
16-Mar-16 10:45am
View
+5
Sascha Lefèvre
16-Mar-16 6:00am
View
It's not a link, it's just underlined to stress the point of my question: You say you want to modify the scrollbar, but
in which way
do you want to modify it?
Sascha Lefèvre
16-Mar-16 3:43am
View
Take a look at NHunspell:
http://www.codeproject.com/search.aspx?q=nhunspell&x=0&y=0&sbo=kw
Sascha Lefèvre
15-Mar-16 19:12pm
View
You answered only my second question
Sascha Lefèvre
15-Mar-16 17:23pm
View
What about it
do you want to modify? And are you talking about WinForms or WPF?
Sascha Lefèvre
15-Mar-16 14:54pm
View
Please tell the error message.
Sascha Lefèvre
15-Mar-16 9:59am
View
You're welcome, glad it worked for you! Feel free to mark the solution as 'accepted' ;-)
Sascha Lefèvre
15-Mar-16 9:39am
View
Not clear at all.
Sascha Lefèvre
15-Mar-16 6:57am
View
No.
Sascha Lefèvre
14-Mar-16 19:18pm
View
Yep :)
Sascha Lefèvre
14-Mar-16 18:06pm
View
I think you overlooked the peculiarity of that character or whatever it is. It's not a simple "a". And he's apparently not asking because of a programming problem he'd be having with it.
Sascha Lefèvre
14-Mar-16 18:02pm
View
+5Additional suggestion for Trader999:
I have a hunch it would make sense making the class linqtosql static, the method GET_DATA static, removing the class-member dctMC and returning qryBOOK.ToDictionary(x => x.ID) from GET_DATA (so changing it from being void to Dictionary<int, MC_VARIABLES>). But as I don't know your intention you have to judge this suggestion.
Sascha Lefèvre
14-Mar-16 17:57pm
View
Not correct, there's a .ToDictionary(..) overload that takes just a KeySelector. The problem here is the missing generic type declaration for the dictionary.
Sascha Lefèvre
14-Mar-16 16:26pm
View
I added a minimal version of it to my solution above, please take a look :)
Sascha Lefèvre
14-Mar-16 16:03pm
View
I assume you've copied only parts from the github-page? Please try with copying the whole code from that page into a new source file (and remove what you've copied from there so far).
Sascha Lefèvre
14-Mar-16 15:33pm
View
When you hover with the mouse pointer over the red underlined this-keyword, what does the popup say?
Sascha Lefèvre
14-Mar-16 15:22pm
View
I assume you placed the method into one of your existing classes - instead, create a separate class for it, e.g.
public static class MyLinqExtensions
Sascha Lefèvre
14-Mar-16 15:19pm
View
Extension methods (those with a
this
-keyword for the first parameter) need to be
public static
and need be contained in a
public static
class.
Sascha Lefèvre
14-Mar-16 15:12pm
View
https://github.com/morelinq/MoreLINQ/blob/master/MoreLinq/DistinctBy.cs
Sascha Lefèvre
14-Mar-16 14:57pm
View
You could just copy&paste that extension method into your project :)
Sascha Lefèvre
14-Mar-16 11:08am
View
The compiler won't allow it in the first place.
Sascha Lefèvre
14-Mar-16 10:50am
View
Please explain your intention - what do you want to achieve here?
Sascha Lefèvre
14-Mar-16 6:54am
View
I don't think you want to use yield unless you've not mentioned your full requirements.
Sascha Lefèvre
13-Mar-16 17:25pm
View
There you go:
https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx
:p
Sascha Lefèvre
13-Mar-16 17:16pm
View
A DataRow-object can't be reused to add multiple new DataRows to a DataTable, you get an ArgumentException "This row already belongs to this table". Please don't base solutions on assumptions, test them if you're not sure about it.
Sascha Lefèvre
11-Mar-16 9:05am
View
Sure! :)
Sascha Lefèvre
11-Mar-16 6:49am
View
The best advice I can give you is to start simple :) May sound banal but I mean it.
Sascha Lefèvre
9-Mar-16 18:19pm
View
You're welcome! :)
Sascha Lefèvre
9-Mar-16 18:12pm
View
With a select query :) e.g.:
SELECT 1 FROM [Users] WHERE [UserName] = @username;
(The last bit is a name of an SQL-parameter, which you should use.)
Sascha Lefèvre
9-Mar-16 14:56pm
View
Sorry, I don't know.
Maybe
setting DefaultView.ApplyDefaultSort to false and then back to true again does the trick. Otherwise I'd take a look at the BindingSource, maybe there's a method to re-sort.
Sascha Lefèvre
8-Mar-16 17:02pm
View
All the above is general .NET, you can use it in VB no problem. The first link is MSDN, there are VB samples for sure. Second link is almost completely language-agnostic. Third link is shown with C# code but is almost the same in VB. Good luck! :)
Sascha Lefèvre
8-Mar-16 13:54pm
View
Thank you, Sergey.
Sascha Lefèvre
8-Mar-16 13:53pm
View
You replied to your own question, not to a comment, so nobody got notified of your comment ;) Use the dim "Reply"-button at the top of a comment to reply to that comment.
Please take a look at my solution (2) where I explained how you can create the code to copy a variable amount of cells.
Sascha Lefèvre
8-Mar-16 11:19am
View
Off topic: We're not a code finding service..
Sascha Lefèvre
8-Mar-16 10:20am
View
bal
is a string,
Val(WithBox.Text)
is a number - so
Val(WithBox.Text) > bal
is comparing a number to a string which is probably the problem here.
I suggest you use
Option Strict
which disallows you to even compile such statements and thus will improve your code quality. At first you'll most probably have several places where you'll have to fix stuff but you'll avoid problems like these!
See here: https://msdn.microsoft.com/en-us/library/zcd4xwzs.aspx
And on the same note,
Option Explicit
:
https://msdn.microsoft.com/en-us/library/y9341s4f.aspx
Sascha Lefèvre
8-Mar-16 9:53am
View
You're welcome! :)
Sascha Lefèvre
8-Mar-16 9:26am
View
Did you observe at which line the exception occured?
Sascha Lefèvre
8-Mar-16 4:34am
View
+5
Sascha Lefèvre
8-Mar-16 3:48am
View
In DisplayArray():
Console.WriteLine(a);
That line writes those four "System.Int32[]" lines. You probably intended this instead:
Console.WriteLine(a[i]);
Sascha Lefèvre
7-Mar-16 19:22pm
View
When you only call Nonyelu.DisplayArray() and ProjectArray_Nonyelu.ReadIntArray() it should compile, does it?
The reason you're having trouble with the other methods is that those aren't static. Static methods can be called directly on the class, whereas non-static methods (= "instance methods") require an instance of the class to be called on. So you need to create an instance of the class ProjectArray_Nonyelu, assign it to a variable and then you can call the instance-methods on it.
Sascha Lefèvre
7-Mar-16 19:03pm
View
+5
Sascha Lefèvre
7-Mar-16 18:25pm
View
Yes. That's to be expected because your methods aren't in SumArray but in ProjectArray_Nonyelu. And I didn't say you should just try it with SumArray ;)
Sascha Lefèvre
7-Mar-16 13:38pm
View
Thank you, Maciej :)
Sascha Lefèvre
7-Mar-16 11:00am
View
Just to make clear: It's not supposed to bring up your class names if you type "Console.". You need to type your class name and a dot to bring up the static members of the class - or the name of a variable of the type of your class and a dot to bring up the instance members of the class.
Sascha Lefèvre
7-Mar-16 3:24am
View
Typing "Console." in Visual Studio brings up a small window with completion-suggestions, containing the valid options for the class "Console", right?
Have you tried this with the name(s) of your class(es) yet?
Sascha Lefèvre
6-Mar-16 18:10pm
View
It doesn't matter in any which way for what purpose you want to do this - it doesn't change anything about the fact that there are no binary numbers. If you're learning about ECC I would assume you know this since very long.
Sascha Lefèvre
6-Mar-16 17:59pm
View
What am I supposed to make of this comment?
Sascha Lefèvre
6-Mar-16 10:14am
View
When you ask for help with an error you should tell the exact error message ;-)
Sascha Lefèvre
6-Mar-16 10:01am
View
Why do you think it would be any different from a single line textbox? The database doesn't care if there are line breaks in the text.
Sascha Lefèvre
6-Mar-16 7:53am
View
I don't see why it would return all rows of the table if there actually are non-matching rows. I know you said you already inspected the items in the list and the rows in the table while debugging but I'm assuming you're overlooking something there; I would suggest you inspect it again.
Just for debugging purposes you might try to limit the items in the list to one and then take a look at the rows in joinForUpdate:
List fin =
...
})
.First()
.ToList();
Sascha Lefèvre
6-Mar-16 6:57am
View
Can you show me the whole method?
Sascha Lefèvre
6-Mar-16 6:28am
View
Are you sure that your DataTable actually contains rows that shouldn't match? Have you inspected it in debugging mode?
Sascha Lefèvre
6-Mar-16 6:15am
View
Right - try this:
{ a = row.Field<int>("A"), b = row.Field<int>("B") } equals new { a = yy.GlobalFieldId, b = yy.BudgetEntityId }
Replace <int> by the appropriate type if other than int. Type members of the "anonymous types" (a and b here) have to be of the same type.
Sascha Lefèvre
6-Mar-16 5:40am
View
The syntax gets a bit unusual at first sight when joining on more than one field in Linq:
join yy in fin on new {row.Field("A"), row.Field("B")} equals new {yy.GlobalFieldId, yy.BudgetEntityId}
Sascha Lefèvre
5-Mar-16 16:53pm
View
from row in dataTable.AsEnumerable()
where row.Field<int>("A") == BudgetEntityId
&& row.Field<int>("B") == GlobalFieldId
...
(change <int> to the required type if other than int)
I mostly choose between foreach (or other types of loops) and Linq in terms of code clarity - which obviously is a subjective matter.
Sascha Lefèvre
5-Mar-16 16:21pm
View
>
Linq isn't faster then foreach approach?
No, there's still "the same" foreach-loop happening, just "inside" of Linq.
>
I think i can use AsParallel() to acheive paralleism to the code u given
That could
potentially
be faster, but not neccessarily, as the CLR dynamically decides whether parallelism will actually be used. You'd have to try it.
Sascha Lefèvre
4-Mar-16 7:42am
View
What would you do "manually" if I asked you for the result of 4x5 and you have to use the multiplication table?
Sascha Lefèvre
4-Mar-16 6:20am
View
+5
Sascha Lefèvre
3-Mar-16 14:41pm
View
Basically right but a bit inefficient to not use a for-loop for the array initialization ;) +4
Sascha Lefèvre
3-Mar-16 14:39pm
View
Thank you Maciej.
Sascha Lefèvre
3-Mar-16 11:33am
View
And the error message is ...?
Sascha Lefèvre
2-Mar-16 10:01am
View
I'd suggest using a proven solution for reading CSV:
http://www.codeproject.com/Articles/9258/A-Fast-CSV-Reader
Sascha Lefèvre
1-Mar-16 10:59am
View
You're welcome!
Sascha Lefèvre
29-Feb-16 13:52pm
View
What about an AI that produces innovative ideas? ;-)
Sascha Lefèvre
29-Feb-16 11:59am
View
You didn't tell which type of LCD you're using so even if we wanted we couldn't give you the required code. But this isn't a code-to-order site anyway.
Google atmega32 (or arduino) and the type name of your LCD and you'll surely find some help with that.
Sascha Lefèvre
29-Feb-16 11:37am
View
What stops you from simply passing the Customer-object to the DAL?
Sascha Lefèvre
27-Feb-16 14:57pm
View
;) thank you!
Show More