Click here to Skip to main content
14,921,361 members

Comments by CHill60 (Top 200 by date)

CHill60 2 days ago View
   
Do you have a function called "Function" and a variable called "ret" ?
CHill60 2 days ago View
   
Have you analyzed your query to make sure it's that last bit that is the issue?
Try putting appropriate indexes on getfinaldatapc and getfinaldatapcmask
CHill60 4 days ago View
   
I would point you towards the article that OriginalGriff has referenced in Solution 1. If you are still struggling then you need to discuss this with your tutor. We can only help with specific problems in this forum and nor will we do the work for you
CHill60 4 days ago View
   
What have you tried? What is the problem?
CHill60 4 days ago View
   
Regarding your "bonus question" - what is the compile error and on which line?
CHill60 4 days ago View
   
I doubt the OP still has this homework assignment nearly a year after it was due, and even if they did it doesn't help them to actually code up Solution 1 - which is all you have tried to do. So you haven't really added anything new to the thread.
This may be your own attempt to produce something for your own homework, so here are some points about your code:
- I tried to run your code. All I got was an error "IndentationError: expected an indented block". Indent your code properly - use the formatting bar or spaces.
- The line i = i + 1 is pointless - it's not part of the loop and the value is never used.
- Why are you adding 1 to the User input - that was not a requirement? Instead that should be happening within the sum_of_numbers function because it is only necessary because you chose to use range(limit) - change that to range(limit + 1) - encapsulate it within the function. Or even better explicitly state the full range and use range(0, limit + 1)
CHill60 4 days ago View
   
If you have a question then use the red "Ask a Question" link at the top of this page. Ensure that you read the Posting Guidelines that will appear when you click the link. However, we are not going to just provide a solution for your homework - you need to do at least some of the work yourself and we will help where we can, with any problems you have
CHill60 4 days ago View
   
Insufficient information. Yes, I have been able to auto generate unit test cases but I doubt very much you want to test the same stuff I was.
CHill60 4 days ago View
   
Fair question :laugh:
CHill60 4 days ago View
   
What have you tried in Linq and what was the problem?
CHill60 5 days ago View
   
Ah, but Richard's is better :)
CHill60 5 days ago View
   
Hence my comment on your solution :-)
CHill60 5 days ago View
   
5'd - couldn't remember the name of the function d'oh.
CHill60 7-Jun-21 5:41am View
   
Whilst I commend your desire to help, you have added nothing new to this 9 year old thread, and by using VB to demonstrate the timingsm, you have gone off-topic (this question is tagged C#)
Answering old questions is a technique used by rep-point farmers so some more trigger-happy members will view this as abuse of the site and start the process to get the account banned.
Stick to answering newer posts, where the OP still needs help, and you should be fine
CHill60 7-Jun-21 5:26am View
   
Instead of trying to "find" a function, write some code to do this. If you get stuck then come and ask for help ...posting the code you have already tried.
CHill60 4-Jun-21 3:57am View
   
It's not your algorithm that is the problem - I suggested you publish a tip rather than resurrect old questions tagged with a different language.
Whether I have successfully done this or not is irrelevant but if I needed to I would probably use InputSimulator 1.0.4[^]
CHill60 3-Jun-21 3:18am View
   
Nevertheless, your solution is off-topic for the question asked. It looks like you are suggesting that the OP spends money on out-of-date tech just to send input instead of using built-in .Net functionality.
Instead of resurrecting ancient posts with off-topic solutions write a Tip instead.
CHill60 2-Jun-21 11:22am View
   
You resurrected an 11 year old post just to post some off-topic stuff? The post is tagged .NET ... NOT VB6
CHill60 2-Jun-21 9:16am View
   
Runs fine for me and produces
Following are the edges in the constructed MST
0 -- 2 == 1
2 -- 3 == 2
0 -- 4 == 0
5 -- 0 == 4
Minimum Cost Spanning tree : 7
How are you trying to run it? If you are double-clicking it in windows try putting
int c = getchar();
before the return in your main routine.
CHill60 22-May-21 10:26am View
   
Well that started working for me now too - must have been a temporary glitch with the fiddle site. I'm updating my solution with an alternative

CHill60 22-May-21 8:21am View
   
An unformatted, uncommented code dump is not a solution
CHill60 22-May-21 8:17am View
   
This is not a solution or even a comment
CHill60 22-May-21 8:14am View
   
If you want to comment on a solution then use the "Have a Question or Comment?" link next to it. Don't put comments in a solution to the original post
CHill60 22-May-21 8:13am View
   
I would do this while populating the gridview in the first place but there is not enough here for me to suggest how to do that. Can I suggest you edit your question and actually add a description of your problem instead of just dumping your code. The title of your question is not enough
CHill60 21-May-21 14:15pm View
   
When I ran it in SQL fiddle I got 0 rows returned. When I changed it to X I got 1 row returned. I had 1 row on my rest table.
Might be a failing of sql fiddle though.
Did you actually try this fix?
CHill60 21-May-21 12:48pm View
   
What is the problem you are facing with the code that you have?
CHill60 21-May-21 12:47pm View
   
You've told us what you want to do but you haven't shared what you have done so far, nor what the problem is. This is not a code conversion service
CHill60 20-May-21 7:01am View
   
If you want to comment on a Solution then use the "Have a Question or Comment?" link next to it.
CHill60 20-May-21 6:50am View
   
And your code is not loading into the debugger? Sounds like you haven't set it up correctly - see How to Use the Code::Blocks Debugger with C Programming - dummies[^]
CHill60 20-May-21 5:21am View
   
Not showing your code? Which IDE are you using?
CHill60 20-May-21 4:55am View
   
Step through the code using the debugger and you should be able to see exactly what happens
CHill60 20-May-21 4:54am View
   
"But this dont work" - does it produce anything or does it throw an exception?
CHill60 20-May-21 4:53am View
   
5'd. Absolutely the right approach - and free!
CHill60 19-May-21 9:01am View
   
"I'm new to this, so I don't know where to start." - Presumably your tutor has given you some course notes? Refer to those first. Please read the posting guideline - we are not here to do your research for you, but we will help with specific problems
CHill60 19-May-21 4:03am View
   
If you need help then you need to post the details of your problem
CHill60 19-May-21 3:56am View
   
Please do not use this forum for your testing
CHill60 18-May-21 9:03am View
   
This is not a solution to the question. If you want to comment on a solution then use the "Have a Question or Comment?" link next to it.
Ce n'est pas une solution à la question. Si vous souhaitez commenter une solution, utilisez l'option "Have a Question or Comment?" lien à côté.
CHill60 18-May-21 8:57am View
   
Re your first problem "When I run the code, the database does not update." - what is in delString?
CHill60 17-May-21 10:18am View
   
Depends what you mean by "improvement"
CHill60 16-May-21 10:20am View
   
The OP probably has upgraded in the last 7 years. However, this unhelpful comment would only have solved the problem if BOTH the local version and the server version were upgraded.
CHill60 16-May-21 10:12am View
   
Is there actually a value in there and what is it? Do you have corresponding data on the database? Is table2 Nothing or does it contain data
CHill60 16-May-21 10:10am View
   
I looked at your stackoverflow qustion - you still have @Foretaksnavn as a varchar. It should be an int
CHill60 15-May-21 12:58pm View
   
What is provincetext set to?
CHill60 15-May-21 12:43pm View
   
If you think by deleting your previous solution you will get rid of my comments, then I'm afraid you are sadly mistaken. As I said on the previous attempt...
There are so many things wrong with this solution it's hard to know where to start.
- it's File.ReadAllLines NOT Files.readAllLines
- File.ReadAllLines returns a string[] not a List<string> (whatever that is)
- It's string[] not String[]
- It's Split not split
- neither records nor columns are declared or assigned a value
- An uncommented code dump is not a solution
- You've tagged as Java but the question is tagged C#
- The question has an accepted answer from 3 years ago
Take more care when posting solutions or you will just gather downvotes (and that can be demoralising)
If you delete this post just to post the same thing again then you will be reported for trolling and your account could be deleted.
CHill60 15-May-21 10:52am View
   
From the use of Range and Rows in your code it looks like this is VBA not VB15, so your options will be limited. You should tag your question appropriately if this is the case.

Based on your comments and sample data all you are trying to do is transpose the columns of data into rows. But I doubt that is really what you are trying to achieve, and I really can't be bothered to try to unravel what your code is doing.

You are going to have to find a way to sensibly explain what it is you are trying to do
CHill60 15-May-21 10:09am View
   
There are so many things wrong with this solution it's hard to know where to start.
- it's File.ReadAllLines NOT Files.readAllLines
- File.ReadAllLines returns a string[] not a List<string> (whatever that is)
- It's string[] not String[]
- It's Split not split
- neither records nor columns are declared or assigned a value
- An uncommented code dump is not a solution
- You've tagged as Java but the question is tagged C#
- The question has an accepted answer from 3 years ago
Take more care when posting solutions or you will just gather downvotes (and that can be demoralising)
CHill60 15-May-21 9:53am View
   
I have made a mistake in my solution - it should read
ALTER PROCEDURE [dbo].[myStoredProcedure] @parameter int<pre>That should fix the error in the where clause.
In your version here in the comment you have put <code>[KjøretøyID] as ID</code> but there is already an <code>[ID]</code> column in the select so you will have to call <code>[KjøretøyID]</code> something else e.g. <pre>ALTER PROCEDURE [dbo].[hentLøyver]
@Foretaksnavn int
AS
BEGIN
SELECT [ID], [LøyvehaverID], [KjøretøyID] as KID
FROM [Løyve]
WHERE [KjøretøyID] = @Foretaksnavn
END
I'll fix the error in my solution
CHill60 14-May-21 6:59am View
   
You don't want a WHERE clause to sort anything, you want an ORDER BY clause in the SQL. If you are going to pass it in as a variable you may need to create some dynamic SQL.
Although reading your question again, regarding ID of the row, then you can pass that ID into the stored procedure as @Parameter and use WHERE ID = @Parameter on the SQL
CHill60 13-May-21 15:12pm View
   
5'd. They lost me with "hi bro"
CHill60 13-May-21 10:36am View
   
What is the problem with FindMyTextx() ?
CHill60 13-May-21 9:13am View
   
This is not a solution to this post.
If you do not know how to interact with your equipment or use the SDK then I suggest you first do some research. A good place to start is with company you purchased the equipment from.
CHill60 13-May-21 3:49am View
   
Some sample data and expected results would be incredibly helpful
CHill60 13-May-21 3:44am View
   
OP wanted to remove the last folder from a path variable NOT delete the actual directory
CHill60 13-May-21 3:39am View
   
On your previous post I explicitly told you to be consistent in your use of braces and you have been told time and time and time again to tidy up your code.
We're not saying this to make things pretty, we're saying this because it makes the problems you are having blindingly, obviously, instantly solvable.
I seriously hope you don't have any more issues because I for one am going to be completely ignoring any post from you from this point forward
CHill60 12-May-21 12:24pm View
   
Just join that final bit of SQL back to the original data e.g.
select a.PERSON		,a.COSTCENTER	,CASE WHEN b.PAYCODE = 'REG' THEN ([REG]/TotalREGIgnoreCC * (40 -SICK)) + SICK 		ELSE b.[Amount] END AS [AMOUNT]	,b.PAYCODE	,b.WEEKINDICATORFROM finally aINNER JOIN SampleData b on a.PERSON = b.PERSON 		AND a.COSTCENTER = b.COSTCENTER		AND a.WEEKINDICATOR = b.WEEKINDICATOR
As I said in my solution, the calculation I've used is wrong and you will need to fix it to match your rules (which I could not follow)
CHill60 12-May-21 11:00am View
   
Unfortunately it is very difficult to read "tone" in the written word. There are some members here who are considered very rude and very abrupt, they happen to be Russian so an abrupt style is just very natural to them and would not upset anyone in their own country (of origin).
It's nice that you are trying to comfort and reassure the OP - very supportive and I applaud that. It might be better if you do that via the "Have a Question or Comment?" link next time, it will help avoid the downvotes (and trolling)
CHill60 12-May-21 8:58am View
   
Foolish advice. Dave Kreskowiak has clearly spent a lot of his time trying to help the OP - the OP has posted the same question 5 times now and we are all starting to get a little impatient with them. However, Solution 1 and the comments on it are attempting to get the OP to think about what they are doing. That is far more helpful than just giving a solution away.
And if you think the comments here or against your own question were "trolling" then you are going to get some nasty surprises out in the real world
CHill60 12-May-21 7:11am View
   
There is a reason for that! Neither SO nor CP are code conversion services. Just rewrite the code in C, it's not exactly complicated.
CHill60 11-May-21 12:59pm View
   
This is the very same problem as your other question Can someone help this is giving me an error, and idk why[^]
And you accepted that solution!
CHill60 11-May-21 12:51pm View
   
The link has some other links about how to use Linq for this, yes. If you go down the Linked Server route then this might help Access MySQL data from SQL Server via a Linked Server[^]
CHill60 11-May-21 11:51am View
   
It is a real PITA trying to keep two separate lists in sync - you have to move forward on one of them until you get a matching ref again - it may be more than one record. You need to let "something" do that heavy lifting - either set up the databases as Linked Servers so you can get all the data in a single SQL query (from both databases at once) or use Linq - both methods will return a single row per Ref with blanks where there is no matching data from the "other" database (assuming you use a left outer join)
CHill60 11-May-21 11:43am View
   
I know you are already populating 2 DTs - I said "as you have done"
Given the fix that Dave spotted, and you say has fixed the problem, I don't see how this code could have worked against the MySQL database as it would have had the SQL bug - hence my point of making sure that the SQL command you are constructing really is the one you think you are running.
The way you are "joining" the information together when populating the listview is assuming that there is one row exactly on both databases for each and every ref. You stated "And one problem is that some products in MYSQL dont have match values in the SQL one." so your method won't work unless you find a way to handle those gaps.
CHill60 11-May-21 11:34am View
   
5'd - flippin' good eyesight!
CHill60 11-May-21 10:40am View
   
Are you absolutely sure the SQL script you have tested is the one you are creating? You should really be using a parameterised query rather than string concatenation
CHill60 11-May-21 7:00am View
   
And what happened with the stuff you tried? Why not post in the forum at that article. By the way your hyperlink is broken - was it meant to be Lotus Notes Integration with Microsoft .NET Platform (C#)[^]
CHill60 11-May-21 5:35am View
   
This is not a solution. If you have a question like this then use Google
CHill60 10-May-21 7:53am View
   
Glad I could help
CHill60 10-May-21 7:03am View
   
If you have a question then use the red "Ask a Question" link at the top of this page. Or better, do your own research!
Funnily enough, it will be the same in ASP.net as it is in the previous solutions here
CHill60 10-May-21 4:51am View
   
If you want to ask a question, then use the red "Ask a Question" link at the top of this page. Do not post comments or questions as a Solution to another member's post
CHill60 10-May-21 3:44am View
   
This is not the case with named parameters (but is the case if you are using something like Access where the parameters are marked with ?).
The problem was that the OP had differently named parameters - as pointed out by gggustafson
CHill60 7-May-21 12:12pm View
   
No. We do not do your homework for you. The point of homework is to benefit you
CHill60 7-May-21 12:10pm View
   
Completely off-topic but try AppleFritter - you need to get better at using search engine e.g. "star trek" "game" "apple i"
CHill60 7-May-21 12:06pm View
   
I've just frightened the neighbours by laughing out loud. 5'd!
CHill60 7-May-21 9:50am View
   
Excellent news! Glad I could help
CHill60 7-May-21 5:59am View
   
Here are some hints that will help you get an answer to your problem.
1. Use the Improve Question link to add detail to your post. If you can't see it then hover over your post and it will appear bottom right corner, same level as your user name.
2. Post the code that you are using to load the tab control, picture box and the stuff you have tried to load the Tiff
3. Explain what "not able to load the picture" means - for example, do you get an error message, does nothing happen at all, does the picturebox only contain part of the tiff - whatever it is that goes wrong, you need to tell us
Be prepared to be flamed for using VB6 and advised to start using VB.NET. It is very good advice as VB6 is no longer supported and has not been supported for decades. There are fewer and fewer people who are able to help on these forums. I will help if I can, but I will need a LOT more detail than that which you have provided here.
CHill60 7-May-21 5:20am View
   
That will count non-null values in [column_to_count]. Nine years ago the OP wanted to count blanks. And don't suggest using
SELECT COUNT(*) - COUNT(column_to_count) FROM table
as that still won't count the "blanks"
CHill60 7-May-21 5:16am View
   
You are more likely to get an answer to your question if you do the following:
1 - Provide us with the schema for tables [payments_header] and [tenders]
2 - Provide Sample data for both tables
3 - Provide the expected results for the sample data provided
Don't give us links to pictures outside this site - many of us are at work and such sites are blocked. Apart from that we can't cut and paste pictures into an IDE.
We do this in our spare time so few people will bother to transcribe your picture into actual data or code, but if you follow my suggestions above, then many more will just copy & paste it to try to find a solution for your problem.
In other words, the better you present your question the more likely you are to get a useful response
CHill60 7-May-21 5:11am View
   
If you want to ask a question relating to a solution, then use the "Have a Question or Comment?" link next to the solution. Do not post follow up questions or comments as a "Solution" to the original post
CHill60 7-May-21 5:08am View
   
If you want to comment on, or ask for further clarification of, a solution posted, then use the "Have a Question or Comment?" link next to it. Don't post your follow up questions or comments as a "Solution" to the original post
CHill60 6-May-21 12:14pm View
   
Beware, answering such an old post (2013) be aware that many trigger-happy members will see this as rep-point hunting and downvote or report your account.
By including a link in your solution, some may also believe this to be site-driving spam
CHill60 6-May-21 12:09pm View
   
Rather than resurrecting such an old post with this it might have been better to post it as a Tip. You would of course have to add some commentary and format your code.
CHill60 6-May-21 5:41am View
   
If you have a question then use the red "Ask a Question" link at the top of this page. Do not post questions or comments as a Solution to another member's post
CHill60 6-May-21 5:40am View
   
Some of the reasons for my downvote
- AddDays returns a DateTime so there is no need to convert the result to a DateTime
- If you are going to convert anything to a DateTime you should use TryParse or TryParseExact to avoid the risk of exceptions.
- An uncommented code dump does not make a good solution
- You have not set the MeetingStatus option so this won't work properly
CHill60 5-May-21 9:43am View
   
Despite none of them working, please share your most successful attempt
CHill60 5-May-21 7:30am View
   
Off topic. Read the posting guidelines
CHill60 5-May-21 7:05am View
   
There is insufficient information here for us to help you. Use the Improve Question link to add information such as what you have already tried
CHill60 5-May-21 7:03am View
   
What database are you using and what happens when your run your code. If there is an error message please be precise about what it says
CHill60 4-May-21 11:44am View
   
And what is wrong with what you have tried? It does seem a little short for the amount of homework set though
CHill60 4-May-21 8:41am View
   
Further to the advice from @OriginalGriff I notice that that package is only 3 days old. That makes me think that you are the author. So, also be aware that using QA Solutions to "drive" people to your site is spam. And that will get you banned from the site!
CHill60 4-May-21 8:37am View
   
Share the data that is in your table that would give the expected results you show. Also share the code that you tried and how the results were not as expected
CHill60 4-May-21 8:32am View
   
We want the actual error message, not your message box text. I.e. ex.Description
CHill60 4-May-21 8:29am View
   
If you want to comment on a solution, then please use the "Have a Question or Comment?" link next to it. That poster will be notified, and the original post will not be dragged back into the Active Questions list.
This is not a "Solution"
CHill60 4-May-21 8:26am View
   
You have dragged this very old question back into the Active Questions list just to repost a snippet from Solution 1. This is not a solution to the question!
CHill60 4-May-21 4:16am View
   
If you are going to ignore @OriginalGriff's sound advice then use PATINDEX. But don't complain here when you fail your course.
CHill60 3-May-21 12:24pm View
   
If you have a question then use the red "Ask a question" link at the top of this page. Read the posting guidelines there. You will have to provide much more detail than this
CHill60 30-Apr-21 12:11pm View
   
I applaud your desire to help, but an uncommented code dump is not a good solution, and this question was answered, and that answer accepted, over a year ago.

Answering old questions especially with multiple updates to the solution, looks like reputation point "hunting" and usually just attracts downvoters.
Stick to answering newer posts, where the OP still needs help, and you should be fine
CHill60 30-Apr-21 12:05pm View
   
I'm sorry I don't understand your comment.
Explain in words what you are trying to get out of the data. The query I have given extracts the records you said you wanted, and only those records.
CHill60 30-Apr-21 7:07am View
   
Should have added - don't forget to handle the exception that is raised when you try to add a duplicate row. Can't give more detail than that without knowing what language you use and how you insert the records
CHill60 30-Apr-21 7:03am View
   
I agree. It could be that the text is already in the correct language and encoding but they are opening it using Notepad. (<< I have recently had the pleasure of arguing this very point with the "Technical Support" team of a major company. "Don't use Notepad to open the file" is my new mantra)
CHill60 30-Apr-21 5:44am View
   
An unrelated, unformatted, uncommented code dump is not a solution
CHill60 29-Apr-21 9:04am View
   
I've just told you how to do it - use the code you have copied and rewrite it, from scratch, in VB.NET. If you attempt to "convert" it you will not only get the errors you are already seeing, but you might find strange results at run-time from using VERY out of date components.
E.g. the first bit of code you have should be using HttpWebRequest.GetResponse Method (System.Net) | Microsoft Docs[^]
CHill60 29-Apr-21 8:58am View
   
What is your question and what have you done to try to solve your problem?
CHill60 28-Apr-21 9:28am View
   
What exactly did you try with xcopy?
CHill60 28-Apr-21 6:26am View
   
An unexplained code dump is not a solution. Especially when it doesn't even attempt to answer the original question.
Be aware that your account may be terminated if members believe this to be abuse of the site, so I suggest that you remove this post and don't do it again
CHill60 27-Apr-21 5:03am View
   
And what is wrong with your code?
What results are you expecting from the data you have given us?
CHill60 27-Apr-21 5:01am View
   
Dangerous to assume that something called "id" is numeric. It could be a UID and for that you need the quotes
CHill60 26-Apr-21 11:06am View
   
What if the data is
|Country|Customer|Number of connections|Number of purchases|Country Metric 1|Country Metric 2
|Brazil|A|10|1|3|1000
|Brazil|B|90|5|3|1000
|Brazil|C|80|2|4|1000
|Namibia|B|20|1|5|2000
|Namibia|C|150|2|5|2000
In other words, you state that data for Brazil should not be "duplicated" so in my example would you still use
(3 + 5) / 2 = 4
or
(4 + 5) / 2 = 4.5
or
(3 + 4 + 5) / 2 = 6

What about the null metrics - should they be included or not (e.g. include in the count of rows, or ignore the row entirely)
"there can be more metrics and other aggregations" - with the same criteria or with different criteria? This "single query" is going to be very confusing. Why must it be the same query? That is a very artificial criterion
CHill60 26-Apr-21 9:48am View
   
Use the debugger to find out what is going on
CHill60 23-Apr-21 9:43am View
   
I seem to be inserting missing things! What a numpty am I. Sorry!
CHill60 23-Apr-21 9:05am View
   
How does solution 1 not prevent duplicates? It removes the card from the deck after it has been dealt to a player. Am I missing something?
CHill60 22-Apr-21 17:18pm View
   
An uncommented, unexplained code dump is not a good solution. Giving someone a ready-baked answer for their homework doesn't help them really. Doing all that over 2 years after they needed the answer...priceless
CHill60 22-Apr-21 4:16am View
   
This is nothing to do with the original question. You may find your account is removed from the site if you dump code here like this. I suggest you remove this "Solution"
CHill60 21-Apr-21 13:37pm View
   
I'm confused... question doesn't appear to have been altered and OP has several questions tagged SQL/T-SQL and none tagged MySQL.
But, yes, CONCAT is also MySQL.
I'm unaware of any such controversy.
Not sure of your point.
CHill60 21-Apr-21 11:22am View
   
"still doesn't work" is not helpful. What happens? What is the error messsage?
CHill60 21-Apr-21 11:20am View
   
What are the symptoms of your problem?
CHill60 21-Apr-21 11:19am View
   
You have explained what you want, but you have not asked a question nor explained a problem
CHill60 21-Apr-21 10:42am View
   
You have added nothing new to the thread - this is essentially the same as solution 1 but with table joins. The OP did not specify multiple tables
CHill60 21-Apr-21 4:48am View
   
I posted the solution in my comment on the solution you have now removed. When I ran that code it produced the solution you require. You need to execute the SQL with
Exec sp_executesql @sql
CHill60 21-Apr-21 4:25am View
   
Please don't post further questions as solutions to your original question - either post them as a comment to the existing solution or using the "Improve Question" link, add them to your original post. You can then attract our attention by commenting on one or both of the solutions posted.
However, the better way would have been to post this as a new question - with a link back to this one to provide the history.

In this case I will answer your question here.

If you look at your results you will see that you have a SINGLE column called '@listSubjects' instead of your three subject columns. That is because you have not created any dynamic SQL.

Full details are in the article I pointed you to ... you create the dynamic sql as an NVARCHAR(Max) and then execute it. I.e.
declare @sql nvarchar(max) = 'SELECT StudentNumber, StudentSurname, StudentName, ['+@listSubjects+']
FROM
(
	select StudentNumber, StudentSurname, StudentFirstNames as StudentName, MarksObtained, SubjectName
	from #temp
) SRC
PIVOT 
(
	SUM(MarksObtained) FOR SubjectName in (['+@listSubjects+'])
) PVT order by StudentSurname'


exec sp_sqlexec @sql
CHill60 20-Apr-21 11:00am View
   
My pleasure! If you get stuck do come back with another question
CHill60 20-Apr-21 8:19am View
   
Values not bound to statement usually means that the parameters have not been set up correctly. You currently have
            // set the corresponding param
            pstmt.setString(1, status);
            pstmt.setString(1, status);
I.e. you are not setting the second parameter. So EITHER change your code to set up both parameters
            // set the corresponding param
            pstmt.setString(1, status);
            pstmt.setString(2, status);
OR hard-code the parameters directly into the statement. As you have accepted Solution 2 as the best answer I assume that is the direction you have taken so just accept this comment as a learning point
CHill60 19-Apr-21 11:25am View
   
There is no where near enough information here for us to help you. Share the code you have tried so far.
CHill60 19-Apr-21 11:15am View
   
parameter is not a type
CHill60 19-Apr-21 5:37am View
   
If you only have 200 items in stock then you can't sell 500. In my example, examine the value of the variable @work and you will see that it contains the shortfall
CHill60 19-Apr-21 4:07am View
   
If you have a question, then use the red "Ask a Question" link at the top of this page. Do not post questions or comments as a solution to another member's post
CHill60 19-Apr-21 4:03am View
   
If you have a question, then use the red "Ask a Question" link at the top of this page. Do not post questions or comments as a solution to another member's post
CHill60 16-Apr-21 11:53am View
   
If you have a question then use the red "Ask a Question" link at the top of this page. Be sure to read the posting guidelines and provide sufficient information so that we can help
CHill60 16-Apr-21 10:49am View
   
As per my comment above. Returns state4 from my sample data - this is where state4 has two cities of the same name, but the requirement is to list states have a common city.
CHill60 12-Apr-21 12:38pm View
   
Why do you need the Y value rather than the relative position within the text box?
CHill60 12-Apr-21 8:53am View
   
OP wanted "to create menustrip dynamically". This comes nowhere close to a solution
CHill60 12-Apr-21 8:48am View
   
Firstly - please use the "Reply" link next to comments so that the poster is notified of your reply. I spotted this purely by chance.
The maximum length of nvarchar is 4000 characters so this will never be complete. But that is a LOT of columns you are trying to output there. Regardless of the maximum number of columns being 1024, no user is going to want to scroll that far!
Which brings me back to my earlier comment - explain what it is you are trying to achieve and provide some sample data and expected results
CHill60 12-Apr-21 8:40am View
   
Reasons for my downvote and report
1. When I run your code I get an exception "The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP, OFFSET or FOR XML is also specified."
2. You are only reporting names but the OP requested the output to include the ID and the years active
3. You will note that the expected results are meant to show each period of 3 years, your solution does not
3. It is not "more human readable" - I had to inspect the code to try to work out the relevence of using ed=nd+1 and nd=st=1 as filters. And I'm still not sure why.
4. You have not explained why LEAD is "better" than LAG (as used in Solution 2 in 2015)
CHill60 12-Apr-21 6:02am View
   
You don't know how to use CStr()? Here is a random thought, try googling "VB6 Cstr function". Or look it up in the documentation that is (was) provided when you purchased VB6.
VB6 a dead language and fewer and fewer people exist out here who can help you all. Do yourself a favour and dump using VB6 in favour of VB.NET - at least there are some half-decent tutorials available for that
CHill60 12-Apr-21 5:54am View
   
You might want to consider using punctuation and quotation marks in order to make that text readable too!
CHill60 12-Apr-21 5:53am View
   
I've just spotted the major problem in your code - see my updated solution
CHill60 12-Apr-21 5:49am View
   
This is a different problem again. You really need to start using the documentation.
You also need to start sharing the exact wording of any errors.
Now, think about this logically. txtAge.Text is a string
rs("V_AGE") is going to be an object containing an integer value (hopefully). You have added & "" in what appears to be an attempt to force the value to be a string. Why not use the CStr() function provided in VB6?
CHill60 12-Apr-21 5:31am View
   
Try to avoid using titles for your questions that are so very similar - it makes people think that you are just reposting the same question, whereas this one is a very different problem and has nothing to do with the textbox
CHill60 12-Apr-21 4:51am View
   
I get a completely different error - "Column '##FinalTable.NXP Automotive' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause."
It might be better if you explain what it is you are trying to achieve and give us some sample data and expected results
CHill60 12-Apr-21 4:29am View
   
Ok, I'm starting to understand the problem now - It's not the @sqldata that is the problem it's the previous code that sets up @result and @col. It's a bit difficult to help without any table descriptions or sample data!
CHill60 12-Apr-21 4:23am View
   
I tried to tidy up your question so that I could understand it, but didn't have much luck as you appear to have pasted random lines into the middle of it - these bits
print sql statement

'Competitor Number of Outputs' as [Competitor Number of Outputs], 'Competitor Output Type' as [Competitor Output Type], 'Competitor Output Voltage' as [Competitor Output Vol

[Competitor Number of Outputs],[Competitor Output Type],[Competitor Output Voltage],[Competitor Rail-to-Rail],[NXP Acceleration Range],[NXP Capacitance Ratio],[NXP M

Please use the "Improve question" link to give us the actual SQL that was printed
CHill60 12-Apr-21 4:17am View
   
Reason for my vote of one ... You have posted a "C++ program to find the sum of.." yet the question was "Convert C++ code to C"
CHill60 9-Apr-21 9:22am View
   
Not quite. If you consider this sample data
declare @TableState table ([state] nvarchar(50), [city] nvarchar(50));
insert into @TableState ([state],[city]) values('state1','city1'),('state1','city2'),('state1','city3'),
('state2','city1'),
('state3','city3'),
('state4','city4'),('state4','city4'),('state5','city1'),
('state5','city2');
then the expected results are
city1 - state1, state2, state5
city2 - state1, state5
city3 - state1, state3
but your code returns
city	state
city1	state1, state2, state5
city2	state1, state5
city3	state1, state3
city4	state4
CHill60 9-Apr-21 7:10am View
   
This is not a solution. Why post this?
CHill60 9-Apr-21 7:06am View
   
Nicely formats the results but unfortunately does not cater for the 2 cities of same name in same state scenario
CHill60 9-Apr-21 4:20am View
   
Please do not dump random code as solutions to other member's posts. Your account is likely to be suspended if you do this again.
CHill60 9-Apr-21 4:13am View
   
This looks like T-SQL. OP is using MS-Access.
CHill60 8-Apr-21 11:42am View
   
In addition to Richard's eagle-eyed observation ... aren't you supposed to validate the response with the Google API and use the result from that validation?
CHill60 8-Apr-21 11:10am View
   
What is in response?
CHill60 8-Apr-21 8:48am View
   
"by using Sleep function in thread after each loop" ... not a good idea. Thread.Sleep is a sign of a poorly designed program. – Peter Ritchie's MVP Blog[^]
CHill60 8-Apr-21 4:48am View
   
You have tagged your question ASP.NET but refer to a WPF application. Which is it
CHill60 7-Apr-21 14:03pm View
   
So display the value of doubloons. What's the problem?
CHill60 7-Apr-21 12:18pm View
   
This is not a solution. If you want to comment on a post then please use the "Have a Question or Comment" link next to it
CHill60 7-Apr-21 10:52am View
   
By posting this as a solution you have removed your own question from the list of active, unanswered questions.
By the way - your questions and comments are not as clear as you think they are
CHill60 7-Apr-21 4:28am View
   
Only works for Adobepdfviewer so not a complete solution - as noted in Solution 1 six years ago
CHill60 7-Apr-21 3:57am View
   
Then try the 2nd solution I suggested. You may need to correct minor errors - I am unable to test it unfortunately because VB6 went out of support decades ago and I'm not prepared to pay good money for it. I stick to VB.NET which is free
CHill60 6-Apr-21 9:46am View
   
Where is this code snippet? Is it in the Combo change event or in save function or what?
Also "other department" is not the same as "OTHER DEPARTMENT" (nor "Other Department") - could that be your problem?
CHill60 6-Apr-21 9:39am View
   
What do you mean by the "limitations of these indexes"?
CHill60 6-Apr-21 9:38am View
   
An unexplained, uncommented, unformatted code dump is not a solution
CHill60 6-Apr-21 8:15am View
   
Sounds like you really do need to implement your own Soundex-alike function - one which removes non-alpha characters, soundex the rest, then put back any numeric that "starts" the string.
Or convince your client to tidy up their data.
CHill60 6-Apr-21 6:19am View
   
Something else I have just discovered is that the SOUNDEX for both '2 inch tape' and '80 tilapia' is being returned as '0000' on my instance here. I don't know why and don't have time just now to investigate. If this is happening for you, you could try implementing your own version of a soundex function OR extract the non-numeric parts of the value using regex then reapply the first n numerics on the compare
CHill60 6-Apr-21 6:09am View
   
Unfortunately because you have used an image rather than just pasting the data into your question I am unable to help further to understand why you are getting seemingly unrelated data in your results. I do not have the time nor the inclination to transpose that information into a temporary table to trial any solutions. Be aware that there is a much faster implementation of the LD algorithm at 35x Improved T-SQL LevenShtein Distance Algorithm...at a cost[^]

Instead of trying to "fix" the problem whilst querying data have you considered alternative approaches ...

If you are getting tens of thousands of records returned that all have the same soundex then consider including additional criteria e.g. CategoryId.

Another approach to attempt would be to limit the variety of input - i.e. validate the data on entry so that it always reads "2 inch tape" or whatever. This would of course require a one-off data cleansing exercise.

If you have 10's of thousands of records with that text in, then perhaps further normalisation of your database would help.

I also note that you example includes the word "tape" whereas your query does not. That could also be a factor
CHill60 1-Apr-21 11:48am View
   
There are a couple of issues with your solution...
1. An uncommented, unexplained code dump is not a solution
2. I doubt the OP has waited 7 years for this solution ... not because you have resurrected a 7 year old question you understand, but because you have copied this solution directly from ebeit303's public fiddles on jsfiddle.net.
That is plagiarism and is not tolerated here.
So, stick to answering more recent questions where the OP still needs help; make sure you are bringing something new to the thread; make sure your solution is either your own work, or that you properly attribute the source.
Your best bet now is to delete this solution.
CHill60 1-Apr-21 11:41am View
   
And your question is ....?
CHill60 1-Apr-21 11:40am View
   
If you don't allow that row at the bottom for users to enter data then it really is that simple. Other approaches I've taken in the past is a "Insert" button which adds a new row for data to be added. Or textboxes (etc) to enter new data (with attendant "Insert" button) which inserts directly to database and then refreshes the DGV. I.e. so the DGV is update/view only.
We've also had the scenario where navigating through the grid would populate the other controls so the DGV became read-only and all updates/inserts via the other controls. We wrote some script to generate those panels.
CHill60 1-Apr-21 8:04am View
   
That "What I have tried:" section is where you need to put the code that you have tried. You also need to provide a more detailed explanation of your problem. For example, are these just random numbers to be summed or is the number going to be on the label next to the checkbox, or the checkbox caption or stored in a the control's Tag property, or ... you get the idea.

Edit: Not sure why on earth you would use nested If statements or even a Switch. Something else code from you will help clarify
CHill60 1-Apr-21 7:56am View
   
Well, yeah. I did wonder if this was a troll in the making or just a "young un" getting frustrated
CHill60 1-Apr-21 5:23am View
   
What is wrong with this code?
CHill60 1-Apr-21 4:17am View
   
Not entirely correct. For a start EF is hardly new technology - it's been around for over a decade. ADO.NET underpins EF and is still being actively supported and new versions released so it's "age" is irrelevant. ADO.NET is not necessarily "faster" than EF - that depends on how the queries are written.
CHill60 31-Mar-21 12:15pm View
   
A period (.) is neither a letter nor a space. It is punctuation. The OP did not want punctuation.
Stick to answering newer posts where the OP still needs help, and make sure you are answering the question actually asked
CHill60 31-Mar-21 12:07pm View
   
Hi Maciej. OP is trying to respond to you via multiple "solutions"
CHill60 31-Mar-21 12:06pm View
   
This is not a solution, it is additional information that should be added to your original post using the "Improve Question" link. If that is not visible try hovering a mouse over your original question and the link should appear to the bottom right of the post.
Furthermore, you have accepted this non-solution as the "Best Answer" - you are unlikely to get any further help from anyone.
CHill60 31-Mar-21 12:04pm View
   
If you want to respond to a post then use the "Have a Question or Comment?" link next to it. Don't post comments as solutions - the responder will not be notified about it.
CHill60 31-Mar-21 9:00am View
   
use the Val() function to convert from string to integer
CHill60 31-Mar-21 6:13am View
   
Platform? Language? What is the error thrown?
CHill60 31-Mar-21 6:02am View
   
The ONLY way to reproduce that problem is to remove the lines
ReDim Preserve TheArray(index - 1)  'Get rid of the empty spaces
SortArray TheArray
I am going to update my solution with the code that you should just paste into your project. If you remove or change any lines then please take care and understand the impact your changes will have. Use the debugger to examine the values in the variables so you can understand why you keep breaking the code
CHill60 31-Mar-21 5:54am View
   
Because I am one of the very few members who will still answer a VB6 question with a VB6 solution (well VBA)
CHill60 31-Mar-21 5:48am View
   
UK definitely had VB3, around 1993 I think. We got to connect to databases via Jet!! Those were indeed "the times" :-)
CHill60 31-Mar-21 5:42am View
   
Did you actually remember to put the SortArray function into the project code as well? It's a public function so as long as it is somewhere in the project you should be able to call it.

The only way you are going to get 1,2,3,4 in your textbox is if the captions of your Checkboxes are "1", "2", "3" etc. You will also need to change the function call to
s = Join(TheArray, ",")
The next problem will be that they will be sorted in alphabetical order, so once you have more than 9 checkboxes they will appear in the "wrong" order i.e. 1,10,11,2,3,4,5,6,7,8,9
If you want them in numeric order you will need to change the type of the TheArray and convert each caption to an integer before putting it into the array.
CHill60 31-Mar-21 5:35am View
   
LOL! I've spent the last 8 years trying to pretend I never used VB6 :-) ... Yes, my last contract was converting stuff from VB3 to VB6. I'm scarred :laugh:
Thank you
CHill60 31-Mar-21 5:27am View
   
You have modified the code so that it will no longer work.
index = index + cBox
you should not even attempt to add a control to an integer! What are you actually trying to do there? Index is an index into the array so just leave that as
index = index + 1
You have also removed the sorting and yet you stated that you wanted this information in ascending order
CHill60 31-Mar-21 5:22am View
   
Also - the value of a checkbox is not 1,2,3 it is checked or unchecked (true/false, 1/0). However, there is enough there in my example for you do change what goes into the Array to be displayed.
CHill60 31-Mar-21 5:18am View
   
Which line is throwing the exception? I'm afraid I don't know what you mean by "checkbox showing block no"
CHill60 29-Mar-21 8:03am View
   
My other points still stand. Especially the bits about lack of comments or explanation and the use of magic numbers. If you don't like the use of regex from Solution 2 then the following is less verbose, easier to understand and doesn't use magic numbers
public static int[] ConvertColor(string coll) 
{
// Convert color string in "Color [A=9, R=9, G=9, B=9]" format to int array 

	//Split on commas to get A R G B
	string [] split = coll.Split(',');
	int [] result = new int[split.Length];
	for (int i = 0; i < split.Length; i ++)
	{
		//Split on = to get the actual values in 2nd element
		string [] split2 = split[i].Split('=');
		//remove the trailing bracket ]
		result[i] = int.Parse(split2[1].Replace("]", string.Empty));
	}
	return result;
}
CHill60 29-Mar-21 5:31am View
   
Reason for my downvote:
- An uncommented, unexplained code dump is not a solution
- You have added nothing new compared to the previous solutions
- You have used an entirely unnecessary goto label1; which is not good practice
- follow your own logic - if a valid number is entered the result is output and the program ends. If an invalid number is entered a message is output and the program ends. You never get as far as your goto statement
CHill60 29-Mar-21 5:18am View
   
"if any better solution, kindly add it here". No, please don't. All that happens is that a very old post ends up being reactivated for no good reason. And as already stated several times on this thread, simply doing someone's homework for them does not help anyone
CHill60 29-Mar-21 4:56am View
   
You haven't really added anything new to this thread and this uncommented method is very cumbersome and not clear at all. Magic numbers 3 and 9 - what do they do?
And worse than that when I run your code with col1 = "[A=255, R=15, G=0, B=255]"; I get a Runtime exception "Index and count must refer to a location within the string."
Stick to answering newer posts where the OP still needs help,
Make sure you bring something new to the thread
and make sure your code actually works
CHill60 29-Mar-21 4:12am View
   
Please allow me to give you some advice on how best to get a question answered:
1. Read the guidelines that are displayed to the right of the page when you click on "Ask a Question"[^]
2. Always include the code that you have tried. Even if you think it is bad. Especially if it "doesn't work". Don't say "I have searched the internet" or "I have tried doing it" - give us your code so that we can help
3. Always explain what the problem is, don't just say "it doesn't work"
4. Never use words like "Important" or "Urgent" - that tends to imply that you haven't left yourself enough time to do your homework, and frankly, we don't care. We do this in our spare time. What is urgent to you is definitely not urgent to us

In theory, you should have been given enough course teaching to be able to get this done. If not then you need to speak to your tutor or follow the tutorials Richard posted in Solution 1.
Homework exercises are set for your benefit.
Here's an article that might help get you started How to Write Code to Solve a Problem, A Beginner's Guide[^]
CHill60 27-Mar-21 17:59pm View
   
How about just the first one that causes this error?
CHill60 27-Mar-21 17:52pm View
   
What does "not working" actually mean? Describe the problem
CHill60 27-Mar-21 17:50pm View
   
You have to share your code. We can't see your screen from over here!
CHill60 26-Mar-21 9:38am View
   
That's ok. You can use the "Improve question" link to update your post.
The more relevant information you put into your questions, the better the chance that someone can help you :-)
CHill60 26-Mar-21 9:36am View
   
Looks like Me.MubsDataSet is not being refreshed. So when you reload the form it is being "initialised" I guess? You need include that in your btnAdd_Click piece perhaps
CHill60 26-Mar-21 8:43am View
   
Is there a question you want to ask?
Isn't this the same as Failed to connect visual basic2010 to ms access 2007[^]
CHill60 26-Mar-21 8:41am View
   
Apart from the fact that this uncommented code dump won't even compile this is no different that Solution 1 - the Accepted Solution from 10 years ago.
I admire your desire to help, but stick to answering questions where the OP still needs help and make sure you are not just repeating what another member has already posted
CHill60 26-Mar-21 8:36am View
   
The "What I have tried:" section is for you to share your code that you are having problems with. Only then are we able to help you. We will not write this code for you.
CHill60 26-Mar-21 5:48am View
   
What are the errors and where?
CHill60 25-Mar-21 13:04pm View
   
There is nowhere near enough information here for us to help you. What have you tried? What platform is this? Please use the "Improve question" link to give us additional information - help us to help you
CHill60 25-Mar-21 11:28am View
   
You have put a constraint on the data that "something" cannot be NULL but you have not populated that data item before attempting to save