Click here to Skip to main content
12,759,875 members (31,765 online)

Comments by Christian Graus (Top 200 by date)

Christian Graus 8-Apr-14 15:30pm View
Yes, 3d on the web has come a long way in the year since I wrote this. But it's still more complex than a forum reply can explain
Christian Graus 27-Mar-14 21:46pm View
I don't see any code to set a tooltip here. I also see nothing to do with SQL Server
Christian Graus 24-Mar-14 5:38am View
No matter what, your msgid is your primary key. There is no way around that. If you're getting it back and not controlling it, then it's being generated before your DB row is created. So, I don't see the issue. I didn't realise you receive data then MAKE a call to another API before storing the data. In that case, let that other code generate MsgId, and use it as the primary key. No matter how any other details come to light as you ask more, you said it yourself. Everything rotates around the MsgId. Therefore, it is the primary key
Christian Graus 24-Mar-14 4:47am View
You get a request that does not contain the MsgId. Therefore, you make it up. Therefore, you can get it from the DB when you store the other data there. And there is no mapping from the msgId to the number, the number repeats and has nothing to do with the msgId. If the sender and the number together are unique and the same if they are resent, make the pair of them your primary key.
Christian Graus 24-Mar-14 4:38am View
Then msgid is your primary key and should ideally be numeric, not least b/c the DB will maintain it for you. You can make it a GUID and have it auto generated, or a string and then you'll need to generate it yourself.
Christian Graus 24-Mar-14 4:13am View
I cannot make sense of your question. You get three bits of information. Are you saying you want to set a MsgID to return, which is the key ? Then make it a numeric identity column.
Christian Graus 24-Mar-14 4:02am View
OK, then the whole system is not really designed to work in an optimal way, and you're stuck with it. What do you search on when you look for data ? If you look for a combination of values, create a composite string value as your primary key. There is no ideal way to store this data, because the only key you can have, is a made up one. One that reflects how you search for data, is what you want, if you can. otherwise it's meaningless.
Christian Graus 24-Mar-14 3:29am View
If no primary key exists, then it's a question of if you add an 'id' column to act as one, or if it has no value to you. Beyond that, I'm not sure I understand what the issue is. You can't store records you didn't get, and if different records have the same id, but are not the same record, then the id is meaningless. If you control the clients, can you make the id a GUID, so it's meaningful ?
Christian Graus 23-Mar-14 18:56pm View
Really, you should read a book on MVC. The example has too many bits of code for me to be able to write it out for you. It's very simple though. Pass an id to the URL, and then look the object up from the DB using the id.
Christian Graus 22-Mar-14 19:19pm View
The data is the same for your two data sets. So if something was missed the first time, it gets added the second. Ultimately, if your system is fragile and data can be lost, then it is lost. I don't see what you can hope to do to respond to situations you know nothing about ( how does your DB reflect the data it did not receive ) ? Merge allows you to resend data, and it will only be inserted if it's missing. It's the best possible way I can see to deal with what I think you're trying to say ( that you send data, some of it is there already, and you want to do a set based insert or update of the rest ).
Christian Graus 18-Mar-14 17:30pm View
Why would you need an error log ? Sessions expire all the time, you just need to configure the system to take people back to the login page, and from there back to where they were
Christian Graus 14-Mar-14 21:33pm View
What makes you think that this has anything to do with SQL-Server ? Please don't just cross post blindly, ask a real question here, or don't ask at all. It's not clear at all what you mean, and if I wanted to answer on SO, I'd go there. This is just rude.
Christian Graus 11-Mar-14 18:44pm View
Because it is integrated in to C# already, and if you're using SQL Server, your entire stack comes from the one vendor. If you're using another ORM, I'd not recommend changing, but EF is a good choice to start with on a new project.
Christian Graus 1-Feb-14 17:22pm View
I asked a group of my friends who do PHP to look at this. They looked at it and told me you have no idea what you're doing and are beyond help. They also suggested what I've already told you to do ( store it in the session ). Sorry, I'm not replying any more. It's clear you have no idea what you're doing, to the point that you are unable to do anything with help when it's offered to you. I'm not trying to be rude, I'm just telling you why I'm not going to reply any more. I've tried very hard to help you. You should pay someone to do this work for you.
Christian Graus 1-Feb-14 4:29am View
Even if someone is not logged in, there is still a session. When someone logs in, you store it in the session b/c the session exists BEFORE they log in.

Seriously, how long have you been working on this ?
Christian Graus 31-Jan-14 15:05pm View
Wow - this is still dragging on ? If you stored it in the session, it would still be there when you came back from paypay, I believe. If not, you'd have a DB column for the logged in user with the last file they selected, so that you could pull it out when you had a session under them again. I think the session is the main thing that will do what you want, though.
Christian Graus 24-Jan-14 4:03am View
So one of the OTHER answers in that link will work ? How is the OP supposed to know which one to try, if the one marked as an answer will not work ? I could see some of the others would work, but the link would be hard to follow, if it has 5 answers, and one of the ones that was rejected, is the right one.
Christian Graus 24-Jan-14 3:59am View
I don't care that you answered after me. I don't own the site. I just wonder why so many answers are SO links instead of actual answers on this site.
Christian Graus 24-Jan-14 3:57am View
The thing marked as the answer there, cannot work. You don't maximise by a keypress, so an event handler for a key press can't stop it. Have you tested this, or are you just searching the site and pasting links ?
Christian Graus 24-Jan-14 3:51am View
Correct - the session and the application object are the way to create global variables in a web app.
Christian Graus 24-Jan-14 3:51am View
Are pages the only files in an ASP.NET project ?
Christian Graus 24-Jan-14 3:50am View
I already said that. Why is a SO link a greater authority than what people say here ?
Christian Graus 24-Jan-14 3:49am View
This only works in Internet Explorer and is a bad answer now that HTML5 exists.
Christian Graus 24-Jan-14 3:48am View
You are the one who can mark this as the answer, if it worked. We cannot
Christian Graus 24-Jan-14 3:34am View
No, that's actually not possible. I don't know what you're trying to do. You can read the jquery docs on how to make an AJAX call from your page in general, but I don't know what call you want to make
Christian Graus 24-Jan-14 3:21am View
The error means what it says. The files are not there.
Christian Graus 23-Jan-14 23:49pm View
Wow - both in one article. I searched for two articles for both halves !!
Christian Graus 23-Jan-14 16:55pm View
I'm not sure how 'what have you tried' is a reasonable question when the original question is not related to a specific task.
Christian Graus 23-Jan-14 16:35pm View
OK, I didn't know it worked that way. In that case, no. How would that work ? If your only option is 'stay on this page' then there's no option at all. Instead, I think you want to show a message saying you won't let them leave, and return false, that MAY work.
Christian Graus 23-Jan-14 16:28pm View
FYI, if you gave me a 1 vote, that is a down vote, 5 is a good vote.
Christian Graus 23-Jan-14 16:27pm View
You can route the URL to any path you want.
Christian Graus 23-Jan-14 16:23pm View
cmbfiletypecode.options is null. So you need to set a break point in Chrome and work out why that is, and fix your code.
Christian Graus 23-Jan-14 15:13pm View
My way is a lot more efficient.

Start with this:

SELECT ',' + convert(varchar(2), grade)
FROM register
WHERE register.student_id = r.student_id
group BY month(student_id)
order by month(grade)

replace r.studentid with a value you know has nulls in it. Then experiment. Really, is not null HAS to work.
Christian Graus 23-Jan-14 15:03pm View
select r.student_id [StudentID],
r.building [Building],
(select ab.attendancePeriod + ','
from att_bottom ab
where ab.student_id = r.student_id
and ab.building = '2'
and ab.attendance_c ='T'
AND CONVERT(varchar,ab.attendance_date,102) = convert(varchar,getdate(),102)
AND ab.attendancePeriod is not null

FROM register r

But, why are you turning dates in to string to compare them ? Why not

and convert(date, ab.attendance_date) = convert(date, getdate())

Christian Graus 23-Jan-14 4:55am View
Yes, that's right. It also does not run, 'out.push. should be 'output.push'
Christian Graus 23-Jan-14 4:47am View
Well, I don't doubt it, but you shouldn't try 25 different regexes. You should take one, and make it work. Clearly your code, not the regex, is the issue.

Is something breaking javascript in your page, so that the validation js does not run ?
Christian Graus 23-Jan-14 4:41am View
*sigh* This is very inefficient. My solution is much neater.
Christian Graus 23-Jan-14 4:40am View
Don't try 20-25. They ALL work. Work out why none of them work when you use them wrong.
Christian Graus 23-Jan-14 4:28am View
Yes, the column MUST be nvarchar, or varchar. You don't need nvarchar for the letters kv and numbers.
Christian Graus 23-Jan-14 4:27am View
You mean to specify routes ?


is from my code, underneath is the GetThumbnail method of my ImageData WebAPI controller, and it takes an id parameter. But, I could have made the URL anything I wanted.
Christian Graus 23-Jan-14 4:26am View
Then you either need to add a reference, use a newer MVC version, or use regex :)
Christian Graus 23-Jan-14 4:09am View
5 voted because I edited my answer after seeing something I missed in yours, and mine was marked as the answer :-)
Christian Graus 23-Jan-14 4:08am View
Yes, you're right, that code is broken. You need to return the result of a prompt.

A confirm box is what you need.

Still curious why you want my help, if you won't vote for my answer, and perhaps even down voted me.
Christian Graus 23-Jan-14 3:59am View
Yes, but it will still be a very stupid way to do things....
Christian Graus 23-Jan-14 3:50am View
Yeah, you are right. He needs to convert to int in order for it to sort properly
Christian Graus 23-Jan-14 3:36am View
If you're checking a condition that is in the first table, then you need to do where (TestId = 1 or TestId is null) because when it's null ( from the left join ), it does not equal 1.
Christian Graus 23-Jan-14 3:23am View
You realise this is what I said, right ?
Christian Graus 23-Jan-14 3:13am View
He used that terminology, but it's very clear what he meant.
Christian Graus 23-Jan-14 2:55am View
Oh, I see. You didn't tell us what the actual issue was. Someone else managed to read your mind.
Christian Graus 23-Jan-14 2:42am View
WRite proper ASP.NET code. If you're using a third party library, read their documentation. You need to set the DataSource of a data bound control, and call DataBind, and it will display as a table.
Christian Graus 23-Jan-14 2:35am View
Well, your master page normally does not derive from a class like that ( a non Microsoft class ). So, you did something. Create a new master page, don't set any options. See what it derives from, and copy that value across.
Christian Graus 23-Jan-14 2:11am View
I've told you quite a few times now. You need to store it somewhere with a name that identifies who is logged on, so you know what image to load. I've sure given you a lot of help, given that you marked someone else as having given the correct answer....
Christian Graus 23-Jan-14 1:30am View
"public partial class MyConnection : DbContext"

This is Entity Framework code. If you don't want to use EF, write a data layer by hand, that's your other option. Then you can put the connection string in your web.config, hard code it, put it where-ever you like.
Christian Graus 23-Jan-14 1:27am View
Why do I get a 1 vote ( this is bad ) for giving a correct answer ?

You need to read about how the web works. All C# code runs on your server. No, you cannot fire a popup. You can't stop your whole page lifecycle from running for every page request. All you can do is emit the javascript to show a popup once the page life cycle has ended and the browser is showing the page.

I don't usually ask for votes, but if you voted me 1, please change it to a 5 if I helped, or explain why you gave me a bad vote. Marking my reply as the answer also helps me AND helps the site because it shows the question was answered.
Christian Graus 23-Jan-14 0:19am View
I changed the title of your question because it was vague and meaningless before. I hope what I put is correct, if not, please edit it, but still keep it more specific
Christian Graus 22-Jan-14 22:49pm View
If it's a seperate JS file, then MVC will not parse that file to run the code you've put in there ( unless it started to do that in version 4). Check your source on the client side in Chrome and make sure it reads the way you expect it to.

OK, I understand, it's a summary that you're showing, of data from previous pages. If the data is in the database, then I don't see why this would not work. But I think you're saying it's in the session ? Have you set breakpoints on that final AJAX call to see what the data on the server is, and what it is returning ?
Christian Graus 22-Jan-14 20:15pm View
No, the one you're restoring TO, can be newer than the one you created the backup from.
Christian Graus 22-Jan-14 18:53pm View
Ah... then your SQL is being automatically generated for you. You can't talk to a database without SQL, if you write it or not. The easiest way to avoid SQL, is to use Entity Framework, that will create classes based on your DB structure, and you can create instances, and add them to your DB. That's what I recommend learning.
Christian Graus 22-Jan-14 17:19pm View
Nope, this is wrong.
Christian Graus 22-Jan-14 17:12pm View
This is a jsp, you marked your question as asp
Christian Graus 22-Jan-14 16:35pm View
I guess at the end of the day, once you have a little experience, good naming practice will happen automatically. But that will come sooner if you work at it.

You write to the DB the same way you read from it. You create SQL commands and you execute them. is an article on how to do this.
Christian Graus 22-Jan-14 16:33pm View
FWIW, I am in Australia, I am in bed when you flood this question with additional questions.

To do that, you would store the image somewhere in the file system or your DB, so that when you redirect to a page after the payment, you'd pick up the image and use it, because it was in a location where you'd know that's what it was.
Christian Graus 22-Jan-14 16:32pm View
I don't do PHP, it's really ugly and outdated. This started as an AJAX question. I think you need to think clearly about what you want, and ask again. Don't say things like 'it's not working', it DOES work. Say things that are specific, posting your code, and telling us which bit you can't work out how to do. I can't answer 'it's not working' except to tell you that that code DOES work. You just need to use it right
Christian Graus 22-Jan-14 16:29pm View
You don't need AJAX OR web-api for that, that's just basic javascript to do the conversions and I'd use jquery to push the results on to the page. So, go ahead, read a bit, try some things, and ask SPECIFIC questions when you're stuck, posting your code so we can see what you've tried and where you need help
Christian Graus 22-Jan-14 16:28pm View
Consider reading some online articles, there's tons of them.
Christian Graus 22-Jan-14 16:27pm View
If you want to disable the second until the first is clicked, that's really easy, with jquery or javascript. That's not what you seemed to be asking. The control uploads as soon as you select a file. So, you can't select two files THEN upload, it just does not work that way.
Christian Graus 22-Jan-14 0:01am View
Are you still stuck ?
Christian Graus 21-Jan-14 23:44pm View
There is no master page on the client. There is only one block of HTML and javascript ( and external js files, but they are not in any way bound by the master page ). So, you're throwing up a new issue, which should not be an issue at all. You can't 'call controller methods from script', you can only make AJAX calls to controllers ( WEB-API would be the way to do this if you're using MVC4 ).
Christian Graus 21-Jan-14 23:08pm View
Christian Graus 21-Jan-14 22:57pm View
You did it to me AGAIN !!! :-)
Christian Graus 21-Jan-14 22:50pm View
None of the technologies you list, support charting. You're using a library of some sort. Tell us what it is, and show us code, if you want help.
Christian Graus 21-Jan-14 22:41pm View
Great - I was scared that was a trap in the data.
Christian Graus 21-Jan-14 22:06pm View
Chrome does show error messages. IF there's none there, then there's no errors, so that is not the issue. Then you should make your code nicely formatted, and set breakpoints, and step through to see what is happening.
Christian Graus 21-Jan-14 21:45pm View
I never use IE, I don't know.
Christian Graus 21-Jan-14 21:39pm View
He explained why. I guess he's writing macros for IE
Christian Graus 21-Jan-14 19:41pm View
So where did the js code come from ?
Christian Graus 21-Jan-14 19:27pm View
What have you tried ? Where are you stuck ? This is simple code. Why do you need it in vbs ?
Christian Graus 21-Jan-14 19:21pm View
Deleted my other comment, emitting pages and then printing them separately is probably the best solution.
Christian Graus 21-Jan-14 19:19pm View
How does this help ? If he pages it, it won't print at all.
Christian Graus 21-Jan-14 16:53pm View
Well, that's another way to do it. You can call your own C# code inside a stored proc, too.
Christian Graus 21-Jan-14 16:26pm View
Cool - the more you use jquery directly, the more control you have, and the more you know what you're doing.
Christian Graus 21-Jan-14 16:25pm View
You can buy it, that's about it. Or read the links I gave you, to see if it's needed, because I doubt it is. Outlook is a mail reader, not a mail server, for a start.
Christian Graus 21-Jan-14 16:16pm View
Christian Graus 21-Jan-14 15:04pm View
Is the first o in 'onLogin' really like that ?
Christian Graus 21-Jan-14 14:30pm View
OK, well, you have two options.

1 - read one of the many articles on how to write a service
2 - set up your script as a scheduled task

2 is easier and will probably work.
Christian Graus 21-Jan-14 14:29pm View
It IS clear. You're just making yourself look stupid. The OP has TWO controls. The question you linked to, has ONE and he's uploaded two files with it.
Christian Graus 21-Jan-14 14:26pm View
That question is asking about what happens when you use the same control to upload two files, one after the other. That's not what this question is about. Thanks for making me feel important by working so hard to try to prove me wrong. I feel sad for you that it's so important to you. I may well be wrong, I don't know *everything*, but in this case, the issue is the same as above, that you're illiterate.
Christian Graus 21-Jan-14 14:23pm View
Yes, I believe I do. I can't imagine where else I might live.
Christian Graus 21-Jan-14 14:19pm View
To be honest, I replied before realising it was you. It was only when you started with this crap that is so typical of you that I noticed.
Christian Graus 21-Jan-14 14:15pm View
This is not a question. Validation is widely documented. If you can't even try, you shouldn't be working on this, it's a trivial task. Of course, if you try and get stuck on something, you can post some code, and ask a specific question, that's what this site is for. But, you should at least try, first.
Christian Graus 21-Jan-14 14:14pm View
Not at all. Most people asking here are not native English speakers. I think it's discouraging when they are told their question is not clear, when in fact it is crystal clear. I am countering your rudeness to someone who both has written an question in good English, AND who has asked a perfectly clear question.
Christian Graus 21-Jan-14 14:10pm View
ROTFL - you tell yourself that.
Christian Graus 21-Jan-14 14:04pm View
Yes, it is very clear.
Christian Graus 21-Jan-14 13:44pm View
Um.... If the only column in your database table is the image, then how will you identify the image down the track ? Even if there's an id and you grab the last image, if it's never used again, then why store it in a DB ? You need to stop and think about this. Will your site never have two users at once ?
Christian Graus 21-Jan-14 13:42pm View
Did you read my answer ? Write a service. A scheduled task can also be used, actually, that may be simpler.
Christian Graus 21-Jan-14 13:39pm View
you don't NEED jquery, but do you REALLY want your clients to do a round trip to the server ? And if you were doing on the server, it's so trivial that it's not worth asking about.

Ultimately, you've posted a ton of stuff that makes no sense to me. Is this image only shown after the Paypal transaction, or is it kept permanently ? If the latter, then just put it in the right place. Actually, in general, storing it in a known location for a user is the way to know where it is when the paypal transaction ends.
Christian Graus 21-Jan-14 13:35pm View
But if you read my answer, the code he posted was correct, and working, and it turned a datetime in to an int in the format yyyymmdd. Yours turns a date time in to an int that, to a human reader, is arbitrary
Christian Graus 21-Jan-14 13:34pm View
If you can't work it out from the links that give EXACT code, then you really should ask yourself what you're doing. You should at least be able to try. I can't give a copy and paste solution without seeing your HTML.
Christian Graus 21-Jan-14 13:33pm View
With an AJAX call, of course. There is no other way, your script is on the client and you need to talk to the server, so you need to talk over the internet.
Christian Graus 21-Jan-14 13:32pm View
Why not ? How can that be ? Do you mean the files you're using are minified and hard to debug ? Certainly Chrome can tell you what the error is, if there is one.
Christian Graus 21-Jan-14 13:32pm View
Well, in that case, you have no choice but to write it SOMEWHERE, and you can put it in a temp location and store in the session perhaps the fact that it's there. Then you'll need to clear out the temp folder from time to time, where people upload and don't save.
Christian Graus 21-Jan-14 4:59am View
Does that mean you provide the machine ? If so, you need to work out what's wrong with it. If not, I don't understand your point. GoDaddy is the host, they are the one to talk to if your code works locally and not on their machine.
Christian Graus 21-Jan-14 4:45am View
Christian Graus 21-Jan-14 3:56am View
Debugging in Chrome, you can see client side errors. js stops working after a script error
Christian Graus 21-Jan-14 3:38am View
You can post your code here, and everyone can help. Just edit your post.

Two seconds with google got me this:

That's how to set the src of an img tag using jquery
Christian Graus 21-Jan-14 3:22am View
Displaying the image automatically is still trivial. Step 1 -> upload image. Step 2 -> add img tag pointing to image file to your HTML. But, if you want to do stuff that involves the Paypal API, then you have to read their docs to see what they support. If your header had been clear, I would not have answered, I know nothing about paypal integration
Christian Graus 21-Jan-14 3:18am View
That's pretty useless. @Tempdata["TbTo"] is not a client side construct. You need to post the actual code, all of it, I think, because it doesn't seem like you know what you're doing.
Christian Graus 21-Jan-14 3:16am View
If you remove the limit, does it return the right data ( albeit too much ) ? I do think a string comparison is the issue.
Christian Graus 21-Jan-14 2:37am View
*grin* thanks. I threatened to not do a SS2008 solution, but then the afternoon dragged, so I thought 'why not' ?
Christian Graus 21-Jan-14 2:37am View
How else did you expect to display it ? Your subject line was confusing. You want to do a paypal step inbetween, that was not clear. Showing an image after you upload it, is trivial. You will need to look at the Paypal API if you intend on going through Paypal in the middle of that process.
Christian Graus 21-Jan-14 0:59am View
I don't know, but if it's html then the answer is yes.
Christian Graus 21-Jan-14 0:47am View
The tree view
Christian Graus 21-Jan-14 0:47am View
Christian Graus 21-Jan-14 0:45am View
I use both all the time, you can use either whenever you like.
Christian Graus 21-Jan-14 0:35am View
Beat me by less than a second !!! :-)
Christian Graus 21-Jan-14 0:21am View
I can't imagine why you need a link. Take the HTML you use to create your reports, and put them in an ASPX page.
Christian Graus 21-Jan-14 0:09am View
That's odd. Perhaps setting a connection string causes it to open automatically ? I'd expect the connection string to be passed to the constructor. Either way, if it's open, you don't need to open it, it's not actually an issue - add code that checks if the State != Open and then open it only if you need to.
Christian Graus 20-Jan-14 23:45pm View
When he asks a real question, I will. I can't do anything without seeing what his code is. If I wrote a full sample, he'd just complain he couldn't copy and paste it. It's because I am watching and waiting to help more, that I noticed your post and responded to it.
Christian Graus 20-Jan-14 23:43pm View
Wow - the person who 1 voted this has a reasonbly high reputation, my 5 only brought it up to 3. Either way, that's awesome, if that works, I've made a mental note in case I ever need to know this.
Christian Graus 20-Jan-14 23:37pm View
Oh, it's an answer ? I missed that. In that case, it's just a bad answer. Why would you use update panels to do something as simple as copying values between controls ? Why would you have a postback occur for something so simple ?
Christian Graus 20-Jan-14 23:30pm View
Update your question, don't hit 'answer' to ask questions or add detail
Christian Graus 20-Jan-14 23:29pm View
WHAT is happening ? What is the error message ?
Christian Graus 20-Jan-14 22:55pm View
OK, that makes zero sense. You're not using today's date anywhere in there. Nor do you end up with yyyymmdd as the final result.
Christian Graus 20-Jan-14 20:12pm View
It's entirely possible he's deploying to an internal network where he knows exactly how those machines are configured.

Interesting that CP blocks embedding images in your post.
Christian Graus 20-Jan-14 17:51pm View
Well, the fact is, I've seen this error, and it's NEVER been permissions, it's always been a handle left open. I am interested to know why you feel it could be anything else, because I've never seen a case where it was.
Christian Graus 20-Jan-14 17:45pm View
You're saying if I don't have permission to access a file, the error will say 'the file is open in another process' ?
Christian Graus 20-Jan-14 17:43pm View
The problem I have is that you're not posting the code where you're trying to do this. The information you provided, is apparently about the bit you knew how to do. What does your code look like ? What is happening ? Is there an error message?
Christian Graus 20-Jan-14 17:18pm View
Wrong. The error does not mean it can't overwrite, it means it's already in use. No amount of permissions will change that. You are right that having a different name would make it work, but it would not fix the underlying issue.
Christian Graus 20-Jan-14 16:24pm View
Please in future, title your question properly. 'How can I solve this problem' is an equally valid header for EVERY post on these forums.
Christian Graus 20-Jan-14 13:45pm View
Jörgen has told you exactly what to do, with a link that explains it. Do what he said, and ask if you get stuck.
Christian Graus 20-Jan-14 13:43pm View
Your script changes the URL. That's not what you said you wanted to do at all ? Why does the master page change when the id changes ? If you're using MVC, why are you using the query string ? How is @TempData a valid variable name in C# ? Why are you setting server side variables ? Shouldn't you create a viewmodel and pass it to the view ? You need to explain more, this looks broken to me, or at least, like you're not using MVC properly
Christian Graus 20-Jan-14 5:21am View
There's no easier way, unless you've misrepresented question. Post your code so I can see what you're doing, your question is still not 100% clear, I think.
Christian Graus 20-Jan-14 4:23am View
It would be better if you edited your post so this would be more readable, but you'll notice, both the other answers you got were correct, but we couldn't give you the exact text because we did not have the code.
Christian Graus 20-Jan-14 4:23am View
Why call ToString, when you're already accessing the Text property ?
Christian Graus 20-Jan-14 3:05am View
Well, if it's a commercial product, CP has a section for that.
Christian Graus 20-Jan-14 2:42am View
If it's not free, it should not be a general article, and you should report it.
Christian Graus 20-Jan-14 2:19am View
If you google you can find heaps of samples on how to send SMS using GSM in C#. That you're using ASP.NET is irrelevant, the code is the same, but your GSM phone will need to live plugged in to your server for it to work. If it's done manually, then you're probably better off writing a winforms app for your admin to use.
Christian Graus 20-Jan-14 2:04am View
Doing this via GSM is stupidity for the reasons I stated. It won't work, what if two users want to send an SMS at the same time ? That's forgetting that you'd pay for all their messages. So, you need to find a webservice that works in the area that your users will be, and subscribe to it.
Christian Graus 19-Jan-14 23:26pm View
I think it's better, if something would be stupid, to not give people the idea that it might not be, by telling them how to do it....
Christian Graus 19-Jan-14 23:19pm View
Of course, what I said still holds. His users won't pay for the texts, he will. It's the wrong solution, there's web services you can subscribe to, to send SMS messages much more easily.

What happens if two web requests want to send an SMS at the same time ?
Christian Graus 19-Jan-14 22:41pm View
Yes, so after you define it, assuming its called m, you do this:

m[1] = new List<string>();

Then you can do

foreach(string fruit in m[1])
Christian Graus 19-Jan-14 21:59pm View
Oh, sorry, I was wrong. You can't trigger on a select, as nothing changes. You can only trigger if your data changes. You'd have to replace your select statements with stored procs that also do what ever it is you want to do at the same time.
Christian Graus 19-Jan-14 15:36pm View
THat's because that's not what you asked.
Christian Graus 18-Jan-14 23:28pm View
Glad to hear it. I'm really glad that you read the article and were able to solve your issue from there.
Christian Graus 18-Jan-14 23:07pm View
Did you know you don't need to define the table, insert into will create the table if it does not exist ? This is an awful solution though, it merges the data, but not in any meaningful way.
Christian Graus 18-Jan-14 22:59pm View
I've updated my answer.
Christian Graus 18-Jan-14 17:56pm View
Amusingly, this is plain wrong :-)
Christian Graus 18-Jan-14 17:56pm View
I prefer not to give copy and paste answers to people who have obviously posted their homework
Christian Graus 18-Jan-14 17:48pm View
You should not use this nonsense. You should write a proper data layer. The stuff you're using is for children to play with computers, not for real programming. Even if you're a child who is learning ( which seems likely to me ), you should still side step this stuff. Really you should learn MVC instead of ASP.NET.
Christian Graus 18-Jan-14 17:47pm View
The same question was asked twice, I just answered the other one. A lot of people create multiple accounts, but there's no way the other question I saw was not the same as this one.
Christian Graus 18-Jan-14 16:48pm View
You would either use the Text property in C#, or if you want to do it on the fly, you'd use jquery or just javascript to find the control, and change it's contents.
Christian Graus 18-Jan-14 16:34pm View
IT's VERY clear
Christian Graus 18-Jan-14 4:41am View
Of course, the result will be somewhat arbitrary, given that if they have the same id, surely they are the same thing. You should order by locid and then scheduledcompletion, I think. But, I still think the person asking, has SERIOUS issues with their database.
Christian Graus 18-Jan-14 4:39am View
A trigger fires inside the database. It allows you to inject code INSIDE the database on an event. It does the sort of thing you're asking for, but only inside the database. It cannot talk to the world outside the database.
Christian Graus 18-Jan-14 3:39am View
My code will return values if you have a full set of data that conforms to what you seem to be asking. Your sample data can never return values from my proc. Do you know SQL at all ? Do you understand what I wrote ? I explained it - my code looks at matches for today, yesterday and the day before. I can't easily test it because your sample data was for only one day. No, I am not going to type up the SQL to insert the data below, you need to provide it in that format for me. And you need to EXPLAIN what you want. Given the sample data below, what format do you WANT the return value to be ?

Most people would be astonished that I am still trying to help you, you don't seem to want help enough to answer some basic questions.
Christian Graus 18-Jan-14 0:00am View
Yes. I know the answer, but I was trying to keep it a secret from you, but you wore me down.

Read my answer again. No, it's not possible. Your DB does not know how to talk to the outside world, unless you can do something via .NET code, which will certainly slow it down. Imagine having a lot of data coming in, and each new row has the added cost of looking up and calling a web service ( which, as I said, is the only real way of doing it that I can see unless the server is on the same network as the app being used )
Christian Graus 17-Jan-14 13:53pm View
But, he's showing two supplier names on the one row.
Christian Graus 16-Jan-14 23:25pm View
Yeah, like those two.
Christian Graus 16-Jan-14 21:41pm View
Please don't hit 'answer' to make a comment. Mark his answer as correct, and hit the 'have a question or comment' button to respond, as I have done.
Christian Graus 16-Jan-14 19:30pm View
I think perhaps a mapping table or a column with ids to the right name to pull out, might make sense. The first question though is, why do I want the adjacent name in certain instances ?
Christian Graus 16-Jan-14 18:47pm View
I have no clue. Obviously it has to do with the framework it's running inside.
Christian Graus 16-Jan-14 17:13pm View
That means that your text was not just a number. There's no way adding a number to this SQL, would give that error.
Christian Graus 16-Jan-14 17:12pm View
If he parses the value as an int, he's never going to have to worry about SQL injection in this code, at least.
Christian Graus 16-Jan-14 17:02pm View
OK - I don't care if you use more than one forum, but regard that the people in each forum hope you respect them enough to ask the full question there.

I've changed it so that it will return 0s for days there's no matches for either of the prior days. Still unsure of what you want, let me know if this helps or not.
Christian Graus 16-Jan-14 17:01pm View
My code returns no values because there's no values in your sample data across three days. I will edit it so it returns 0s.
Christian Graus 16-Jan-14 16:35pm View
A pic is NOT A sample. SCRIPTS where I can create tables and data, are a sample.

So you want to add tables to keep track of returns and installment plans, is that right ? What have you tried ?
Christian Graus 16-Jan-14 0:04am View
Why can't you ask a proper question in this forum then ? That's a lot better, but it's still not clear what you want. Try just answering my questions. Try respecting THIS forum if you want to be helped here.
Christian Graus 15-Jan-14 17:05pm View
I don't understand. DB2 is a database, Java is not. The answer is the same, if you want to do many database actions in one call, use a stored procedure, and consider transactions if you want your changes to be atomic.
Christian Graus 14-Jan-14 16:51pm View
You can use any clause you like. Once the linked servers are set up, you can write SQL as if they were the same server, and it all works the same ( of course, it could be slower, depending on where the two servers are )
Christian Graus 14-Jan-14 16:31pm View
You could use ABS to get rid of the negative issue. Then I think this is the nicest way to do it.
Christian Graus 14-Jan-14 16:28pm View
No, I have not sold my soul to multi level marketing. That does not matter. So you want to compare rows between days. Please edit your question. Honestly, I am answering you every day and getting no close to being able to help you. Edit your question with the output format you want, explaining what the data means. Give us examples of every type of output you want, and then once we understand what you need, we can try to help. I THINK you may want a count for today and a count for yesterday. SS2012 would make this trivial, but I can do it in SS2008. I just don't want to put in a lot of time before you're clear that what I do, will answer you.
Christian Graus 13-Jan-14 20:18pm View
I recommend buying a book and learning to do basic research. Post what you've tried, and if you've not tried anything, you should.
Christian Graus 13-Jan-14 19:36pm View
IF you run SQL outside a proc, you can make a transaction and not commit it ( although I expect when you did so, you removed the 'return', which was your issue )
Christian Graus 13-Jan-14 17:03pm View
Wow - thanks, I did not know that. I just wrote an article, now I need to update it :-)
Christian Graus 13-Jan-14 16:48pm View
How on earth could you hope to download anything, using SQL ?
Christian Graus 13-Jan-14 16:42pm View
I have NO idea what you're asking for. That's why I keep asking. I am SURE I can solve your problem, if you'd just explain it clearly. I asked some questions, answer them. Do you have SS2012 ? Do you want to compare rows between days ? Do you want to compare them between levels ? What are you trying to do ?
Christian Graus 13-Jan-14 16:40pm View
You can do that with row_number. Assuming your table has an id column, do this:

with dups
select id, row_number() over (partition by id order by id) as row from myTable

select * from dups where row > 1

replace select * with delete, to delete duplicates.

has more info.
Christian Graus 13-Jan-14 0:02am View
Hey, I know. Let's see how many people can give the same answer !!!
Christian Graus 12-Jan-14 18:38pm View
This sort of DB design is always a nightmare. Can you change it ? It's a common antipattern.
Christian Graus 12-Jan-14 16:41pm View
It's a dumb question. The database component is so trivial, that you can design it any way you like. You should just buy a basic DB design book and read it, if you have no clue how to do this.
Christian Graus 12-Jan-14 13:24pm View
Well, it's still not clear, because my code does that. Do you mean you want to count on the same row, how many pairs there where yesterday AND today ? Do you have SQL Server 2012 ? Because it has new methods that will help with that.
Christian Graus 9-Jan-14 21:56pm View ?
Christian Graus 9-Jan-14 18:38pm View
Pushing 'answer' to comment or ask more questions is also not the way things is done, esp if you then mark your comment as an answer.

I reiterate. When you say 'am just a beginner and have never done a complete project', my first question is, what makes you think you can do one now ? That's not to be rude, it's to say, you should not expect to magically be able to do a full project, even if you assume we're going to do a lot of the work. You should take one part of this ( probably C# ) and learn it until you're good at it. Then learn database stuff using EF ( which frees you from learning SQL, although that's not suitable for high use databases ). Then learn MVC, and along the way, learn javascript/jquery. Then you can tackle a large project.

I assume this is not a paid project, or a school project, so you can wind back your expectations and learn one thing at a time ? There's TONS of books, as I said, on each of these topics, as well as lots of articles here on CP.
Christian Graus 9-Jan-14 17:33pm View
The errors you are posting all mean EXACTLY what they say. Googling the exact error message will also give you help. We're happy to answer, but you need to be able to do some basic research of your own, and understand what you're doing enough to understand the error messages.
Christian Graus 9-Jan-14 17:21pm View
Read what I said again. VS2010 does not support SQL AT ALL. Your SQL Server does. And I think it was new in SS2008.
Christian Graus 9-Jan-14 16:53pm View
True - I saw jobs asking for 10 years of C#, in 2003.
Christian Graus 9-Jan-14 16:46pm View
Probably, but then why ASP and not ASP.NET ? Why ADO.NET AND Entity Framework ? I suspect it's more that he's taken a project, has no idea how to do it, and is hoping for a short cut.
Christian Graus 9-Jan-14 16:25pm View
I don't understand the question. There is no database in VS, although one gets installed iwth it. You must be using an old visual studio if you have VS2005. You should upgrade both. However, you can download the free version of any SS version and install it, and connect to it from Visual Studio.
Christian Graus 9-Jan-14 16:15pm View
The two ways listed. First, store the files on the file system and store a path. Second, store in a DB separate to the metadata DB.
Christian Graus 8-Jan-14 23:06pm View
This is a horrible mess. Never do this. Keep your password in your data layer, encrypted if possible. Pulling it out like this, exposes it to attack.
Christian Graus 8-Jan-14 23:05pm View
Thanks for repeating the advice two other people gave already. I'm sure it helped.
Christian Graus 8-Jan-14 17:30pm View
Repeaters are very cool. by all means ask here if you have any questions that flow on from this one
Christian Graus 8-Jan-14 16:47pm View
Nice to see someone gave code instead of just a link....
Christian Graus 8-Jan-14 16:26pm View
Yes, that's what it looks like. So ?
Christian Graus 8-Jan-14 16:25pm View
Then they want an online solution, there's no other way to do that. Ergo, you need an online solution that can store transactions locally if the network goes down, and sends them when it's back up
Christian Graus 8-Jan-14 16:23pm View
OK, so write a ton of code, or use a library

What does that have to do with this question ?
Christian Graus 8-Jan-14 16:21pm View
You can't create Excel files without excel or another library. You'll have to fix your csv code. What special characters ?
Christian Graus 7-Jan-14 17:27pm View
Fair enough. I assume if people are using such an old version, they should specify.
Christian Graus 7-Jan-14 17:24pm View
Where did he say it was SS2005 ? I can't see that anywhere in his question, is it obvious in the screenshot ?
Christian Graus 7-Jan-14 16:34pm View
You have to type in a new one. It won't show you the old one.

Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 1 Jan 1900
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid