Click here to Skip to main content
15,349,767 members

Comments by pt1401 (Top 42 by date)

pt1401 18-Feb-18 16:29pm View
   
A very very thin one :-)
But, stretching a point, it is a triangle - the three internal angles add up to 180 degrees.
pt1401 18-Feb-18 16:24pm View
   
@phil.o: The OP is trying to compare the circumference of two triangles if you look at his coding attempt.
To do that, the position of the triangles is of no consequence, so you don't need tree points for each triangle, just three lengths.
So three scalar values needed, not six.
pt1401 5-Feb-18 7:27am View
   
Have you tried debugging and stepping through your program?
Which line does it error on? Which method or data member couldn't be found?
pt1401 31-Jan-18 5:54am View
   
On course it is, which is why I suggested he look in his textbook.
If the textbook even exists, the question won't be in it. Neither will the answer.
pt1401 2-Jan-18 16:48pm View
   
Deleted
Sorry, no. You haven't even told us the line that the error is on. You need to learn how to debug - please give it a try and you might surprise yourself by finding the solution all by yourself.

If my answer makes no sense to you, perhaps you might benefit from following some tutorials on using DataGridView.
Either way, "give me the solution" just doesn't cut it.
pt1401 24-Dec-17 16:31pm View
   
And what are the contents of your textboxes?
I'm guessing that either txtAge or txtIC dont have integers in them?
pt1401 18-Dec-17 12:36pm View
   
Did you have any other SQL versions installed previously?
CTP versions that haven't been fully uninstalled can cause this.
pt1401 13-Dec-17 2:37am View
   
Re. "I am expecting query from you".
That's not going to happen without telling us how the data is stored - what's the database schema? Tables? Columns?
pt1401 13-Dec-17 2:35am View
   
Also, please tabulate the data in your question properly.
If it's easy to read, people will be more likely to offer solutions.
pt1401 14-Nov-17 11:06am View
   
I think we need some more information. Such as
Is it always the first six files you want?
Or do you perhaps need all the files starting with
20170505
?
Are the files always in sets of three? xxxF_nnn.jpg, xxxR_nnn.jpg and xxx_yyy.tif?

It always helps to have some info on the logic requirements...
pt1401 7-Nov-17 2:50am View
   
Why do you think you should only get 4 records?
SELECT * INTO #TEMP FROM TEST_DEL WHERE 1=0 inserts nothing, it just creates an empty temp table with the correct schema.
pt1401 2-Oct-17 8:00am View
   
Me neither, what do you mean?
only asking
looking some clues
pt1401 27-Sep-17 13:17pm View
   
I think you need to rewrite your question :-)
pt1401 27-Sep-17 12:56pm View
   
This is a homework question.
There is short-term benefit, but no long-term benefit, in us doing your homework for you.
Long-term benefit is what's important.
It's *your* homework - *you* need do do it so that *you* can learn programmimg.
pt1401 5-Jul-17 3:33am View
   
If you really need to create from an interface, perhaps because you want to inject it, you could create composite interfaces, then create a D using interface ID

public interface ID : IA
{
int p { get; set; }
int F4();

}
public class D : ID
{
}
pt1401 2-Jul-17 16:37pm View
   
Depends on whether you need to inject it.
If not, this would work (and has the advantage of being mind-numbingly simple).
Sometimes the simple way is best.

var myD = new D();
pt1401 17-Jun-17 1:42am View
   
The trick is to read the requirement and identify the objects, operations and variables.
Something like this :-

1) At the start, the elevator is situated at a given floor. Its first action is to load on some passengers
Objects: Elevator, Passenger
Operations: Elevator.Load(int passengerCount)
Variables: currentFloor, passengersToLoad

2) Elevator moves from current floor to destination floor:
- it announces every floor it passes. // Would this part be a loop? Depending how many floors the building has?
-It will not have to stop at any of these floors just the destination floor
Operations: Elevator.MoveTo(int destinationFloor), Elevator.Announce(int floorNumber)

3) At the destination floor it performs two actions:
- offloads a certain amount of riders (not necessarily all of them)
- onload a certain number of people (but do not overload the elevator) // Would these two actions also be loops as well for loading and unloading riders?
Operations: Elevator.Unload(int passengersToUnload), Elevator.Unload(int passengersToLoad)
Variables: maxPassengers

That should give you a starting point for the objects you need (just one, Elevator), and the methods.
Then you need to code the methods by translating the requirements into logic and then code.
What you have is good so far, good luck...
pt1401 21-Apr-17 11:49am View
   
You're auto-generating a C# class based on input created by the user?
Presumably at some point, that class will get compiled & executed.

My initial thought is 'Why?'
It seems dangerous and I feel there must be a better way.
But without knowing what you application is, or what it's supposed to achieve, I can't tell you what that 'better way' might be.
pt1401 20-Apr-17 4:43am View
   
I'm guessing your solution is targeting 'x32' instead of 'AnyCPU' ?
pt1401 16-Apr-17 14:42pm View
   
You need to try harder to help people to help you.

You don't give enough information - for a starter, what error are you getting?
Here's a possibility:-
Your sql string 'sql2' isn't used - your command uses sql1, which you give no details of.

As a side issue, it's not a good idea to build sql with string concatenation.
Do some googling on sql injection and sql parameters.
pt1401 16-Mar-17 16:25pm View
   
Confucious he say "Man who ask 'Please reply me soon' who doesn't acknowledge replies soon, not get reply so soon next time..."
pt1401 5-Feb-17 8:56am View
   
What has this got to do with coding?
pt1401 13-Dec-16 17:00pm View
   
I'm sorry, really?
What I have tried:
"I need...."

So you have tried nothing?
We are not your slaves/servants.
pt1401 3-Dec-16 8:43am View
   
Oh come on.
If you expect people to help you, at least give us a chance.
I get that you want to parse these files using C#, but what language is it that is in the text files that you want to parse?

"What I have tried: I have been struggling for the right code"
But you can't give us any more detailed insight into your struggles?
Cut & paste your attempts below...
pt1401 19-Sep-16 9:37am View
   
> Connect as late as possible, query as fast as possible, and disconnect and Dispose as soon as possible.
Excellent mantra. Developers should have this tattooed on their foreheads in mirror writing :-)
pt1401 17-Sep-16 6:00am View
   
I hope you added a 'Add shortcut to desktop?" option in your installer?
pt1401 16-Sep-16 15:02pm View
   
I don't understand why you'd want to do this.
Surely whether a program is pinned to the start menu should be decided by the user, not by the program that he's running?

Let the user decide - if any program did this to me I'd immediately uninstall it.
pt1401 1-Sep-16 1:43am View
   
I've used both, but have now settled with NLog. They're very similar, but NLog has 5 logging levels vs 4 for Log4Net.
pt1401 9-Aug-16 19:15pm View
   
Really?
Your question: i need the best and efficient way to save image into database
You've tried: i need the best and efficient way to save image into database

It seems you can't even make the effort to tell us what database you're using.
If you want people to help you, you should make some effort to help them help you.
pt1401 22-Jul-16 4:54am View
   
Have you tried running the proc as above and comparing the resultset to the original?
pt1401 22-Jul-16 4:46am View
   
You don't need strSql, use either or the proc definitions above
pt1401 22-Jul-16 4:41am View
   
So I assume the cursor is needed, and there will be something the --PROCESS loop?
If that's the case, I'd write the proc as
CREATE PROCEDURE [dbo].[sp_empInfo]
@empID int =null,
@TesterName varchar(250)=null
AS

DECLARE @emp INT
DECLARE @tester VARCHAR(250)

DECLARE users_cursor CURSOR FAST_FORWARD READ_ONLY FOR
SELECT @emp=ID, @tester=TesterName
FROM emp
WHERE Status=1
AND (@empID IS NULL OR @empId='' OR ID=@empID)
AND (@TesterName IS NULL OR @TesterName='' OR @TesterName=TesterName)

OPEN users_cursor
FETCH NEXT FROM users_cursor INTO @emp, @tester

WHILE @@FETCH_STATUS = 0
BEGIN
-- PROCESS
FETCH NEXT FROM users_cursor INTO @emp, @tester
END

CLOSE users_cursor
DEALLOCATE users_cursor


If the cursor really isn't needed, it reduces to
CREATE PROCEDURE [dbo].[sp_empInfo]
@empID int =null,
@TesterName varchar(250)=null
AS

SELECT @emp=ID, @tester=TesterName
FROM emp
WHERE Status=1
AND (@empID IS NULL OR @empId='' OR ID=@empID)
AND (@TesterName IS NULL OR @TesterName='' OR @TesterName=TesterName)

There's a place for dynamic sql, but it's better no used if it can be avoided.
UPDATE: SELECT @emp=ID, @tester=TesterName
SHOULD BE SELECT ID, TesterName
pt1401 22-Jul-16 3:45am View
   
Because the question was 'why am I getting an invalid column name error' :)
pt1401 22-Jul-16 3:41am View
   
It isn't the right way, because it's horribly inefficient.
Try:-

IF @empID IS NOT NULL AND LEN(@empID) > 0
SELECT ID, TesterName FROM emp Where Status=1 AND ID=@empID
ELSE IF @TesterName IS NOT NULL AND LEN(@TesterName) > 0
SELECT ID, TesterName FROM emp Where Status=1 AND TesterName=@TesterName


Ah ok, that doesn't work when you supply both @empID & @TesterName
pt1401 26-May-16 8:10am View
   
Does the WHERE clause return any records?
Does it return the record(s) that you were intending to delete?
Try changing the DELETE to SELECT * and running in in SQL Management Studio to confirm.

A side issue is PLEASE don't construct SQL like this, it leaves your code wide open to SQL injection attacks. It may just a noddy program for your personal use, but it's a very bad and dangerous habit to get into. Use parameterised queries instead.
pt1401 1-May-16 13:02pm View
   
1. Please format your code listings.
2. Please give the full error message, ideally with a stack trace.

In summary, put a little effort into helping others to help you.
pt1401 27-Mar-16 13:09pm View
   
Without any details of your code, which service provider you're using, or the API details, I doubt that anyone is going to be able to help.
pt1401 11-Mar-16 11:41am View
   
It seems that what you have tried is exactly what you have been set. So how did you get on? What particular problems did you hit, and what have you tried to get around those problems?
Nothing? Guessed not...
pt1401 2-Jan-16 6:39am View
   
Very perceptive of you...
pt1401 25-Jan-14 16:04pm View
   
Reason for my vote of 5 \n Problems publishing images don't deserve downvotes. Hava a 5 in compensation...
pt1401 15-Jul-12 15:21pm View
   
Reason for my vote of 2
This is just a rant. If you're going to give a tip, you should give reasons why your suggestion is worth following - the only reason you give is a single example of someone using Select * in a way that broke *your* code because they used it in a particular way. Select * can be used safely and there are many situations where it's use is valid - though I agree it's generally wasteful on bandwidth and the number of rows returned should be limited. And using it to transfer data between tables is a *BAD* idea.
pt1401 18-Dec-11 12:02pm View
   
Deleted
Reason for my vote of 1
How about explaining what a 'magic square' is? Or what the 'magic squares problem' is?

The code doesn't have a single line of commentry, and without an explanation of the problem it claims to solve it's hard to tell whether it's a good solution - or even it it works.