Click here to Skip to main content
12,064,855 members (39,841 online)

Comments by Mika Wendelius (Top 200 by date)

Mika Wendelius 16-Jan-16 11:23am View
   
The frames are used to define the position for text blocks. If you remove them you remove the position info. How should the text be formatted then?
Mika Wendelius 16-Jan-16 6:31am View
   
Thank you!
Mika Wendelius 16-Jan-16 6:30am View
   
And what is the error?
Mika Wendelius 16-Jan-16 6:29am View
   
That's a good point. If the data comes from SQL Server and from a bigint column then Int64 would be the correct choice.
Mika Wendelius 16-Jan-16 6:22am View
   
Exactly!
Mika Wendelius 16-Jan-16 6:10am View
   
Thanks SA!
Mika Wendelius 16-Jan-16 4:22am View
   
Nice answer!
Mika Wendelius 16-Jan-16 4:21am View
   
Thank you!
Mika Wendelius 16-Jan-16 4:20am View
   
Thank you Maciej!
Mika Wendelius 16-Jan-16 4:19am View
   
Good point, a 5.
Mika Wendelius 16-Jan-16 4:18am View
   
You're most welcome :)
Mika Wendelius 15-Jan-16 15:07pm View
   
Deleted
Does this actually solve the problem?
Mika Wendelius 15-Jan-16 15:05pm View
   
Thanks for the comment. That is one possibility, but I'm afraid that there is a misunderstanding what a join actually does. This is why I suggest going through the join types. Hopefully the OP responds if I've misunderstood the situation :)
Mika Wendelius 15-Jan-16 14:58pm View
   
Sorry didn't notice that you used different columns in the inserts. Now fixed.
Mika Wendelius 15-Jan-16 14:55pm View
   
What about this sentence "all the MemberItemCode vals become NULL. Shouldn't they always be either their original values or 'X'?" As said, you're not updating MemberItemCode at all :confused:
Mika Wendelius 15-Jan-16 14:50pm View
   
The explanation is a bit confusing, you're not updating MemberItemCode nor PAItemCode. Instead you update WVItemCode. Or did I misunderstant the question?
Mika Wendelius 15-Jan-16 1:19am View
   
Since this is a different issue I suggest posting a new question if you haven't already done so. This way you'll get opinions and solutions from several persons.
Mika Wendelius 15-Jan-16 0:26am View
   
Add where? In order for people to be able to help, you have to explain the whole situation and the requirements. Please use the "Improve question" link to add more explanation.
Mika Wendelius 11-Jan-16 6:28am View
   
Yoy're welcome :)

Basically if the answer provides a solution for you you can accept the solution by pressing the green "Accept solution" button. This changes the state of the question from unanswered to answered and helps people to see which questions are still open or have a valid solution if they encounter a similar problem.
Mika Wendelius 11-Jan-16 6:24am View
   
Probably the query you're running doesn't cast the data from datetime to date. So either change the query or if you want permanently to remove all time data from that column, change the column's type from datetime to date in the database. However, note that this operation is irreversible so you must be sure before doing it.
Mika Wendelius 11-Jan-16 0:13am View
   
The the cells in Excel. Changes are that the data is correct but if the column is too narrow, Excel will show large numbers in that format. So click in a cell and see what it actually contains
Mika Wendelius 10-Jan-16 23:34pm View
   
Instead of posting a new question, improve the original one using "Improve question" link.
Mika Wendelius 10-Jan-16 23:18pm View
   
Glad to hear it heled.

Your current problem is that since the Word instance isn't created in the beginning anymore, you need to create it in the code before using. Consider the following.

If myFileOpen = False Then
set myMSWord = New Word.Application << create the instance
myMSDoc = myMSWord.Documents.Open(myNewsLetter) <<< Fails here
myMSWord.WindowState = Word.WdWindowState.wdWindowStateNormal
Mika Wendelius 10-Jan-16 14:19pm View
   
That's great to hear :)
Mika Wendelius 10-Jan-16 13:33pm View
   
You seem to define a variable for Word interop and instantiate it immediately. Have a look at line

Dim myMSWord As New Word.Application

If you take out New keyword, the creation should not happen anymore. The same applies to the document.
Mika Wendelius 10-Jan-16 10:49am View
   
Do you mean you want to loop those lines of code? If so, what are you actually looping, some predefined file list?
Mika Wendelius 10-Jan-16 8:55am View
   
Sample data and sample output would really help to understand your question.
Mika Wendelius 10-Jan-16 8:53am View
   
Nicely spotted!
Mika Wendelius 10-Jan-16 6:27am View
   
You cant use non-deterministic functions with constraints. This is why you can't use SYSDATE in a check constraint statement.
Mika Wendelius 10-Jan-16 4:45am View
   
Glad if they helped :)
Mika Wendelius 10-Jan-16 4:44am View
   
Can you post an example data for the scenario. It would help to understand the requirement
Mika Wendelius 10-Jan-16 4:39am View
   
Since this is completely different question, please post a new question in Q&A.
Mika Wendelius 10-Jan-16 0:33am View
   
Exactly :)
Mika Wendelius 9-Jan-16 15:42pm View
   
The main problem is that you do validations after inserts. Move all the validations into the beginning of the sub and if they all succeed do the inserts after that.

Another problem is that you're not using transactions for multiple statements. I suggest reading Properly executing database operations[^]
Mika Wendelius 9-Jan-16 15:16pm View
   
You're most welcome :)
Mika Wendelius 9-Jan-16 15:07pm View
   
Thank you :)
Mika Wendelius 9-Jan-16 13:44pm View
   
You're most welcome :)
Mika Wendelius 9-Jan-16 13:16pm View
   
Well explained.
Mika Wendelius 9-Jan-16 13:14pm View
   
Thanks SA :)
Mika Wendelius 9-Jan-16 10:35am View
   
Do you use ClickOnce for publishing?
Mika Wendelius 9-Jan-16 10:06am View
   
Don't post additional info as solution. Instead use the "Improve question" link to make changes to your question.
Mika Wendelius 9-Jan-16 9:20am View
   
They aren't worth a pound each? What a pity :)
Mika Wendelius 9-Jan-16 9:18am View
   
Deleted
Is this Access or Sql Server?
Mika Wendelius 9-Jan-16 8:31am View
   
Well explained, deserves a 5
Mika Wendelius 9-Jan-16 8:31am View
   
Thanks :)

No worries, OG explained the problem well so the main thing is that the problem got solved :)
Mika Wendelius 9-Jan-16 8:30am View
   
Thanks :)

Don't worry about those, they come and go :)
Mika Wendelius 9-Jan-16 6:14am View
   
That's the problem. As I said, identity was introduced in 12c.

Note that the client tools and their versions do not affect this since it's a question of database server functionality.
Mika Wendelius 9-Jan-16 6:04am View
   
Thanks :)
Mika Wendelius 9-Jan-16 6:03am View
   
What version of Oracle server do you use?
Mika Wendelius 8-Jan-16 14:19pm View
   
Same idea at the same time :) +5
Mika Wendelius 8-Jan-16 1:35am View
   
Thank you :)
Mika Wendelius 8-Jan-16 1:35am View
   
Thank you :)
Mika Wendelius 6-Jan-16 16:10pm View
   
You're most welcome :)
Mika Wendelius 6-Jan-16 14:28pm View
   
Thanks, and excellent year 2016 to you too :)
Mika Wendelius 6-Jan-16 14:18pm View
   
Please provide the code where the error comes from. Also explain what is the identity proofing service you use.
Mika Wendelius 6-Jan-16 14:13pm View
   
That would help to generate the headers for the groups :)
+5.
Mika Wendelius 6-Jan-16 14:12pm View
   
When you say it's not working, what do you mean? Does it compile, do you get an error at run time, is the behaviour not what's expected or something else?
Mika Wendelius 6-Jan-16 12:18pm View
   
As far as I can see the data is the same but the order is different. Is the problem that you want to order the data. If so, you should use ORDER BY clause. Have a look at ORDER BY Clause (Transact-SQL)[^].

But still if you want an additional row between the decades, it's best to do that on the calling side.
Mika Wendelius 6-Jan-16 8:25am View
   
Can you explain the problem in more detail?
MikaW 25-Nov-15 4:59am View
   
But then again, there are conversations like this https://social.msdn.microsoft.com/forums/windows/en-us/b3360e34-633c-49d8-99c3-8108e557ef47/clickonce-and-command-line-parameters[^]. However, I just can't seem to find a working solution for combination: UNC + online + startup parameters...
MikaW 24-Nov-15 14:00pm View
   
That applies when the ClickOnce application is launched using an URL. In my situation the application is started from a network share using an UNC path, e.g. \\server\share\folder\someapp param1 param2
MikaW 24-Nov-15 12:59pm View
   
Thanks for the link but that applies to an offline installation. Or at least I can't get it working with online install mode.
Mika Wendelius 8-Oct-15 1:36am View
   
I understand that you're using the program to do the import but in order to see what goes wrong and how to correct it, it's more simple to use SSMS as a test bench. When you get it working in SSMS then write it in the program. This simplified the error-solving process.
Mika Wendelius 7-Oct-15 23:33pm View
   
Yes, that makes sense, but the question is, why? In what kinds of situations this is useful?
Mika Wendelius 7-Oct-15 23:31pm View
   
Yes, I noticed that it's part of the spec but why only with initializers. I modified a question and added an example method call which would be a bit similar situation. However, in such case the extra comma isn't allowed...

I marked a 5 on the answer and will accept it in time but I want to leave the question open for awhile in case some other points are raised.

Thankls :)
Mika Wendelius 7-Oct-15 23:28pm View
   
This could be one explanation. But why not systematically allow this, why just with initializers...

I marked a 5 on the answer and will accept it in time but I want to leave the question open for awhile in case some other points are raised.

Thanks :)
Mika Wendelius 7-Oct-15 8:38am View
   
Instead of writing the commands into the program, try first creating the linked server in SSMS and running the query in SSMS. This way you can ensure that the commands that you build are correct.
Mika Wendelius 4-Oct-15 4:37am View
   
Thank you for the comments. It seems that the colour definition isn't supported as you said. However a predefined class "hightlight" exists so that helped me to emphasize the parts I wanted the reader to notice. Thanks for the effort.
Mika Wendelius 4-Oct-15 4:34am View
   
Yellow is just fine. Thanks, this worked like a charm!
Mika Wendelius 3-Oct-15 10:52am View
   
Why would you do such change? This would cause problems upon uninstall.
Mika Wendelius 2-Oct-15 14:00pm View
   
Since you're using a database, I believe that the only feasible way is to split the phone numbers to a separate table. With a design like this you'll cause a massive amount of headaches and performance problems.
Mika Wendelius 2-Oct-15 2:13am View
   
CAn you post the whol call sequence:
F:\ABC_code\Ad Hoc Emailer\ABC Ad Hoc Emailer\ABC Ad Hoc Emailer\Program.cs:line 455
at ABC_XYZEmailer.Program.Main(String[] Args) in F:\ABC_code\XYZ Email
er\ABC XYZ Emailer\ABC XYZ Emailer\Program.cs:line 153
Mika Wendelius 2-Oct-15 1:38am View
   
I see you're new to CodeProject so welcome.

"any one give me solution in vb.net, webcam photo stored in sql database.
all of insert,update,delete operation"


However this is not the way this community works. If you want someone to do the coding for you there are a lot of sites to hire a programmer to do programming.

In CodeProject the idea is that people help each other with specific problems in programming tasks on voluntary basis. In other words this means that people won't do programming for you.

If you're stuck in a specific question, please post all the relevant code fragments and explain the problem you have.
Mika Wendelius 2-Oct-15 1:16am View
   
I'm sorry but I don't quite understand the situation. Do you restart the web site every day or something like that?

Not sure but one option could possible be to use a constructor of a static class. This would be called only once during the lifetime of an app inside a pool. But as said I'm not quite sure what is the requirement you have.
Mika Wendelius 1-Oct-15 23:27pm View
   
As far as I can see the problem is that you instantiate a blank form. Use the form you have created.

In other words replace
private Form _usernameInstance
with
private LoginPage _usernameInstance

and replace
this._usernameInstance = new Form();
with
this._usernameInstance = new LoginPage();
Mika Wendelius 1-Oct-15 23:23pm View
   
I'm not sure if I understand your concern. All the operations inside the parallel for are executed before the loop ends. So perhaps the question is more of what operations you include inside the parallel block.
Mika Wendelius 1-Oct-15 14:47pm View
   
If you don't have any password protection on the Access mdb you can skip the username and password.

However, the main problem with OPENROWSET seems to be that ad hoc queries are not allowed in your system. Have a look at ad hoc distributed queries Server Configuration Option[^]
Mika Wendelius 1-Oct-15 14:30pm View
   
I'm sorry but I don't quite understand. The computed column isn't a normal column. It's more like a formula and the result of the formula may or may not be stored in the database, depending on the options used for the column.
Mika Wendelius 1-Oct-15 14:21pm View
   
Darn, thanks for pointing that out!
This is what happens when you code with notepad... :)

Not sure but I understood that the left button down was the 'click' OP meant that needs to be generalized. I could be wrong though.
Mika Wendelius 1-Oct-15 13:51pm View
   
You're welcome :)
Mika Wendelius 1-Oct-15 0:09am View
   
As far as I can see your original procedure already does that. You're just missing the cursor keyword from the beginning of the declaration (see the example I wrote).

If the procedure isn't working as expected, have you checked that the query really returns rows? Also if the result variable should get the value from the procedure being called check that you have defined the parameter as OUT or INOUT, depending on the situation. See CREATE PROCEDURE[^]
Mika Wendelius 1-Oct-15 0:00am View
   
You're welcome :)
Mika Wendelius 1-Oct-15 0:00am View
   
You can't update a value of a computed column. The whole idea is that the column is calculated automatically. In many situations the column value isn't even stored in the database but calculated when you fetch it.
Mika Wendelius 30-Sep-15 16:20pm View
   
What is the exact problem? Do you need to have a column which would contain a calculated value based on rows from two or more tables?

If that is the case then I think using a trigger would be an option. Can you explain the whole situation?
Mika Wendelius 30-Sep-15 16:11pm View
   
If I understand correctly remaing_income is a computed column and you're trying to update it? If that is the case yo can't do that. A computed column cannot be changed. If the result is wrong for the column then you need to modify the formula for the column.
Mika Wendelius 30-Sep-15 15:34pm View
   
Have a look at the updated solution
Mika Wendelius 30-Sep-15 15:01pm View
   
Have a look at the modified answer.
Mika Wendelius 30-Sep-15 13:01pm View
   
I believe it would be helpful if you'd add the code you have and explain where you have the problem.
Mika Wendelius 30-Sep-15 12:19pm View
   
You're welcome :)
Mika Wendelius 30-Sep-15 11:07am View
   
That should work just fine, a 5.
Mika Wendelius 30-Sep-15 11:06am View
   
Looks good, 5.
Mika Wendelius 30-Sep-15 0:12am View
   
That was the second problem I listed. Since you have that fixed, I'd suggest going through the other things also: Parameters and INSERT syntax :)
Mika Wendelius 29-Sep-15 16:11pm View
   
No worries! If all the operations that make modifications to the database are done inside a single transaction then the transaction should cover he whole unit of work.

Of course this is a subject to be tested with a real situation for example by deliberately generating errors in order to see that all the changes are rolled back properly.
Mika Wendelius 29-Sep-15 14:22pm View
   
Do you get some errors or what?
Mika Wendelius 29-Sep-15 14:01pm View
   
I'd suggest debugging the code line by line. For example if creating the application fails the workbook is still null so the code in your question would fail.

You didn't post the catch block but it's important that you handle the exceptions properly. That's the only way your program can tell what has gone wrong.
Mika Wendelius 29-Sep-15 13:54pm View
   
If all the operations are inside the transactionscope then they are part of the transaction.

Since the original code looked like this

using (dbcontext = new DBContext())
{
//read from context here
//modify context here
using (transactionscope = new TransactionScope())
{
dbcontext.SaveChanges();

//some additional context updates
transactionscope.Complete();
}

I thought that part of the modifications were done before entering the transaction. But as said if they are inside transaction, they are safe :)

Either way I'd still prefer setting the transaction on outermost level.
Mika Wendelius 29-Sep-15 13:48pm View
   
Not sure if I understand this correctly, but instead of creating new combo box items, why not utilize the data rows? Have a look at the updated solution.

The example tries to show how you can just select an existing row from a table's data view and set that DataRowView in the SelectedItem without ever knowing the index of the item in the combo box. So all the time the code is working with the data in the tables and it's not even investigating the selected indexes or looping through the items in the combo box.
Mika Wendelius 29-Sep-15 13:15pm View
   
Looks good also, a 5.
Mika Wendelius 29-Sep-15 13:14pm View
   
Looks good too!
Mika Wendelius 29-Sep-15 13:14pm View
   
Thanks
Mika Wendelius 29-Sep-15 13:14pm View
   
Thanks
Mika Wendelius 29-Sep-15 13:11pm View
   
If i understand the requirement correctly, that shouldn't be a problem. Have a look at the modified solution.
Mika Wendelius 29-Sep-15 2:42am View
   
As far as I can see the solution you tried has several places where things can go wrong. The first thing is that it doesn't use parameterization so strings may end too early depending on the data and problems with type conversions may occur.

Another thing is that depending how the WHERE clause is built you may quite easily end up with syntactical problems.

Query builders are fine in many situations but if you really don't need them I wouldn't use them. Many times simple, fixed operations work much better and are more easily maintained.
Mika Wendelius 29-Sep-15 0:53am View
   
Thank you sir!
Mika Wendelius 28-Sep-15 17:27pm View
   
As far as I can see you could probably use Group Policy Management Console Class Library[^]. I haven't used that library so I have no experience if it's the right tool for you, but with a short investigation I believe you'll easily see if it's feasible or not.
Mika Wendelius 28-Sep-15 17:03pm View
   
Glad it helped :)
Mika Wendelius 28-Sep-15 17:02pm View
   
Thanks!

Yep, it's awfully often I see different kinds of lists stored in a single column while all the fuzz could be avoided by adding a simple child table. I haven't yet figured out why such solutions are so tempting...
Mika Wendelius 28-Sep-15 16:59pm View
   
With a low rep member? Why on earth would the amount of reputation affect my opinion on a member??? The amount of points you have (or do not have) tell absolutely nothing about your knowledge or you as a person, they are just points...

To be honest, some of the best comments I've got have come from "low rep" members with a lot of knowledge :)

However, I'm afraid we're flooding this question so if you don't mind let's continue the discussion elsewhere. I added a post in my personal profile page so when you have time feel free to post the comments over there.
Mika Wendelius 28-Sep-15 16:40pm View
   
Looks like a solution :)
Mika Wendelius 28-Sep-15 16:36pm View
   
Are the tables really located in different databases or do you have two tables in the same database?
Mika Wendelius 28-Sep-15 16:18pm View
   
Nice answer!
Mika Wendelius 28-Sep-15 16:16pm View
   
Glad it works :)
Mika Wendelius 28-Sep-15 16:08pm View
   
I just realized: If you're only referring to the uniqueness of the detail table then I partially agree what you're saying. In that case what you're after is a natural key[^]. And yes, it's a good practice to always have at least one natural key. However, it's not mandatory.

Still, what comes to the foreign key definition there is no requirement that the foreign key must be part of the natural key. In many situations one of the foreign keys acts as part of the key but not in all cases.

The main idea of a natural key is to prevent logical duplicates (same person, same product, same order etc). Now if the key of the child table would contain the foreign key column to the master table plus the additional, generated line number this would give no more protection against duplicates as would a surrogate key. Each time a new child row would be added for the same parent a new line number would be generated.

Now if there would be a rule in the system that only one child row for a single parent row can be added per day then the foreign key column along with the date column could define a good natural key. But as said this highly depends on the system and the requirements.
Mika Wendelius 28-Sep-15 15:43pm View
   
I'm still quite puzzled. I do know what a compound key is but what I don't understand is why the foreign key column should be part of the key of the child table. I can see that this could be a design principle of a specific system but in general I haven't heard of such requirement.

Let's take an example; You have a Person table (in this example it's a parent) and then you have an Order table. Among all other columns the Order table has these four columns:
- ReceivedBy, foreign key to Person, nullable
- PackedBy, foreign key to Person, nullable
- ShippedBy, foreign key to Person, nullable
- BilledBy, foreign key to Person, nullable

Now each one of these columns defines a separate one-to-many relationship between Person and Order, however, none of these is logically part of a key. After all the same combination is most likely to exist several times. So the order would probably have some completely other primary key.

Personally I like to use surrogate key[^]. If you think about the concept of a surrogate key it is forbidden to use any actual data as part of the key, otherwise it won't be surrogate. However, using a surrogate key does not mean that I cannot define a one-to-many relationship. The key of the child table is separate from the relationship definition.


Perhaps there's something I'm missing or misunderstood...

Oh, and from what I see there's nothing wrong with your English :)
Mika Wendelius 28-Sep-15 15:07pm View
   
Thanks for the comment.

I don't quite understand why a compound key would be required when creating a one-to-many relationship, could you explain a bit more?
Mika Wendelius 28-Sep-15 14:18pm View
   
Even though you posted that you have solution I believe it would make sense to post the code how you build and execute the SQL statement. This way we could check if there's something to correct with code.
Mika Wendelius 28-Sep-15 9:56am View
   
Could you explain the requirements with example data
Mika Wendelius 28-Sep-15 9:46am View
   
That's what I suspected. In your version 1 those operations would be outside the scope of a transaction so you would not have a single unit of work.

Because of this I'd always prefer using the transaction scope as the outermost element.
Mika Wendelius 28-Sep-15 0:45am View
   
Okay, and what is the formula for the totals? How they are to be calculated?
Mika Wendelius 28-Sep-15 0:16am View
   
Two questions
- how would the salary and pf totals be calculated?
- is this Oracle or SQL Server (you have tagged both)
Mika Wendelius 27-Sep-15 14:50pm View
   
To add to the previous question, think about the situation when you go in front of other students and they ask you questions about the code that you can't explain, simply because it's not your code. Probably not a situation where you want to be...

The best investment you can do is to invest in yourself by learning new things. Sometimes it takes more effort but I can promise, it's rewarding in the end.
Mika Wendelius 27-Sep-15 14:11pm View
   
Exactly, 5'd
Mika Wendelius 27-Sep-15 13:55pm View
   
Hope it helps :)
Mika Wendelius 27-Sep-15 13:04pm View
   
Sounds good.

Based on the symptoms the problem is most likely on the server side so that's where I'd start looking.

60 seconds for a connection is a long time even via a slow network. However if the server is busy doing everything else it could be that it just can't give a new connection in time.

When you get any new info, please let us know.
Mika Wendelius 27-Sep-15 10:48am View
   
Thanks Mehdi!
Mika Wendelius 27-Sep-15 10:39am View
   
You need to show what is the definition and content of view_1 and what is the logic you want to apply. You're the only one who knows the requirements and the data.

Please use "Improve question" link to add relevant information to the question.
Mika Wendelius 27-Sep-15 9:16am View
   
So if I understand correctly, the data in your question is taken from a table so it's not a result set for a PIVOT query?
Mika Wendelius 27-Sep-15 8:59am View
   
If I understand your question correctly, this is a result from a PIVOT query. If that is true, what is the query you use?
Mika Wendelius 27-Sep-15 8:33am View
   
Ok, so if the SQL Server is located on a hosted server, you cannot use named pipes as the communication protocol, you need to use TCP/IP. Depending on the technology you use to establish the connection the way to configure the client may differ. One reason behind this could be the firewall blocking TCP/IP connections.

Please go through the steps described in Steps to troubleshoot SQL connectivity issues[^]
Mika Wendelius 27-Sep-15 8:18am View
   
What is the exact error message you get?
Mika Wendelius 27-Sep-15 8:12am View
   
Yes, the user id is the name of the user (or actually login) as recognized by Sql Server
Mika Wendelius 27-Sep-15 7:29am View
   
Thanks!
Mika Wendelius 27-Sep-15 7:29am View
   
Good points!

By the way, just to make sure, did you get my email?
Mika Wendelius 27-Sep-15 7:27am View
   
You're only redimensioning the array in the code so I don't know how you use the array but have a look at the modified solution.
Mika Wendelius 27-Sep-15 6:52am View
   
Okay so this is Oracle. The syntax is a bit different but I'd say you could use a different approach. Have a look at the modified solution.
Mika Wendelius 27-Sep-15 6:15am View
   
It would help if you would post the relevant code fragments. Use the "Improve question" link to make modifications to your question and more information about the situation.
Mika Wendelius 27-Sep-15 4:46am View
   
Based on your new question in how to update and insert based on swap rows in sql server[^] this query seems to produce correct data except for 103 where again deptname differs. The result from the query for 103 is

103 G 2 hr

So I'm not sure why the deptname should be "Ja"...

However, as far as I can see you should be able to use the select as a basis for an insert statement. For example

INSERT INTO SomeOtherTable
SELECT ...

or if you want to create the new table on-the-fly, then perhaps

select a.id,
a.name,
a.[check],
a.deptname
into SomeOtherTable
from emp1 a
...
Mika Wendelius 27-Sep-15 4:37am View
   
You already asked this in swap few rows in sql server[^] so no need to repost at least not so quickly.

Instead post a comment to the relevant solution to tell what was wrong with the answer and most likely the person will make modifications etc.

Also leave some time for others to answer instead of posting new questions.
Mika Wendelius 27-Sep-15 4:20am View
   
And on what line you get the error?
Mika Wendelius 27-Sep-15 3:30am View
   
Good links
Mika Wendelius 27-Sep-15 3:30am View
   
Thank you.
Mika Wendelius 27-Sep-15 3:30am View
   
You're welcome :)
Mika Wendelius 27-Sep-15 2:25am View
   
To be honest it's impossible to say since we know nothing about the indexing, file organization etc. EXISTS and NOT EXISTS clauses are often very fast but without running the execution costs in the target database it's hard to say.
Mika Wendelius 26-Sep-15 17:41pm View
   
Looks good.
Mika Wendelius 26-Sep-15 11:32am View
   
Thanks :)
Mika Wendelius 26-Sep-15 11:31am View
   
What else would the return type of get be than T defined in class B?
Mika Wendelius 26-Sep-15 7:48am View
   
Now yo have added the parameter values to the command but you don't define the parameters in the SQL statements. The statements should be like the one I wrote in the answer:

Insert into tblinfo(patient_no,last_name,first_name,middle_initial,birthdate,gender,phone_no,address) VALUES (:patient_no, :last_name, :first_name, :middle_initial, :birthdate, :gender, :phone_no, :address)
Mika Wendelius 22-Sep-15 10:39am View
   
Client locale is one thing but have you checked the server side locale that Informix uses?

Please have a look at IBM® Informix® Client Software Development Kit, Version 4.10 / Set a GLS locale[^]
Mika Wendelius 21-Sep-15 14:03pm View
   
The new XML wasn't valid since it didn't contain a root element. Also it it did not contain same id's for hosts as the second XML. So I made some modifications to it. Have a look at the modified solution.
Mika Wendelius 21-Sep-15 6:39am View
   
In order to add the condition I would need to see the whole first XML document. In your example the first XML document contains only elements inside 2080 so as far as I can see, all the members inside would be included.

Is the idea that the first XML is somehow different or have I misunderstood something?
Mika Wendelius 21-Sep-15 1:13am View
   
You're welcome :)
Mika Wendelius 21-Sep-15 1:08am View
   
Thanks Maciej
Mika Wendelius 20-Sep-15 15:43pm View
   
Exactly.
Mika Wendelius 20-Sep-15 13:22pm View
   
Glad it helped :)
Mika Wendelius 20-Sep-15 7:21am View
   
What have you done so far, where are you stuck at?
Mika Wendelius 20-Sep-15 3:58am View
   
Have you tried adding

using System.Linq;

in the class module?
Mika Wendelius 20-Sep-15 3:37am View
   
You're welcome.
Mika Wendelius 19-Sep-15 14:21pm View
   
I tried that but the code was running as expected, only the debugger wasn't. Because of that I ran clean and restarted VS, no difference. But as it turned out the solution was in Release mode. However I don't quite see why the debugger was working partially...
Mika Wendelius 19-Sep-15 14:18pm View
   
When investigating the IL I noticed that the code is optimized. The solution configuration in the toolbar and the project configuration window showed Debug but when opening the Solution configuration window the configuration was Release. Changing it to Debug solved the problem.

Not sure if this is related to not hitting the first breakpoint but the output in C# in ILSpy showed quite a big difference between the definitions in Debug and Release code:

Debug:
------
string text = "\r\n...";
string text2 = "\r\n...";
XElement xElement = XElement.Parse(text);
XElement xElement2 = XElement.Parse(text2);
...

Release
--------
string arg_0B_0 = "\r\n...";
string text = "\r\n...";
XContainer arg_21_0 = XElement.Parse(arg_0B_0);
XElement xElement = XElement.Parse(text);
...
Mika Wendelius 19-Sep-15 14:03pm View
   
Good link, 5!

Good to keep in mind that in order to see the name of the WiFi network, it needs to broadcast the name :)
Mika Wendelius 19-Sep-15 13:54pm View
   
Good catch!
Mika Wendelius 19-Sep-15 13:52pm View
   
Thanks Maciej
Mika Wendelius 19-Sep-15 13:33pm View
   
Care to put the suggestion as a solution so I could comment and accept it.
Mika Wendelius 19-Sep-15 12:37pm View
   
Two things I discovered. First of all it's (partly) my mistake. While the project was set to Debug the configuration for the solution was Release. When changing the solution config to Debug, everything worked. I just still don't quite understand the behaviour though...

Going through the IL I discovered that I'm not able to reliably interpret it so I'm not certain if it contains any oddities...
Mika Wendelius 19-Sep-15 12:10pm View
   
I turned it off and now no breakpoints are hit. Did I brake it? :laugh:

But seriously: Sorry, I forgot to mention that I tried both clean and restart. However I didn't investigate the IL, good point. I'll have a look, hold on :)
Mika Wendelius 19-Sep-15 12:02pm View
   
Thanks Maciej :)
Mika Wendelius 19-Sep-15 11:33am View
   
Looks like a good solution! 5.
Mika Wendelius 19-Sep-15 10:44am View
   
Don't add your email address in the question unless you really like spam :)
Mika Wendelius 19-Sep-15 8:25am View
   
Have a look at the modified answer.
Mika Wendelius 19-Sep-15 8:03am View
   
And the idea would be to know the cost for each stock out row, right? So what should be updated or should the procedure just return the current value for the product based on the stock usage?
Mika Wendelius 19-Sep-15 7:20am View
   
How could the later rows contain a greater value if the data is ordered using the order by statement? You did notice the ORDER BY clause?
Mika Wendelius 19-Sep-15 7:19am View
   
As far as I can see the post is effectively the same. Please add an example with some data, what you want to achieve. This is necessary in order to transform the logic.
Mika Wendelius 19-Sep-15 4:54am View
   
What is the read and write code you currently have?
Mika Wendelius 19-Sep-15 4:53am View
   
Not sure if I understand correctly but something like the following?

SELECT * FROM Student ORDER BY TotalMarks DESC LIMIT 0,9
Mika Wendelius 19-Sep-15 4:51am View
   
Can you explain the idea what to should be updated for each row? Perhaps a data example?
Mika Wendelius 19-Sep-15 4:45am View
   
Good advice, a 5.
Mika Wendelius 19-Sep-15 4:45am View
   
Thank you.
Mika Wendelius 19-Sep-15 4:23am View
   
I'm sorry but I don't understand your question. The limit controls how many records are returned and the order by controls the ordering before limit.

Is the ordering the question or something else?
Mika Wendelius 19-Sep-15 3:35am View
   
You're welcome. Glad it helped :)
Mika Wendelius 19-Sep-15 2:00am View
   
Really nice!
Mika Wendelius 19-Sep-15 1:58am View
   
Nice options!
Mika Wendelius 19-Sep-15 1:56am View
   
Good links! a 5.
Mika Wendelius 19-Sep-15 1:55am View
   
Thank you.
Mika Wendelius 19-Sep-15 1:55am View
   
Agree, a 5.
Mika Wendelius 19-Sep-15 1:54am View
   
Thank you.
Mika Wendelius 19-Sep-15 1:46am View
   
The basic workflow would be
- fill the combobox with names (possibly form database)
- when the data is fetched extract the name from the combobox
- place the selected name into a parameter and build the proper command
- execute the command and receive the results for example into a dataset
- use the data in the dataset as a source for the gridview

In which part you're stuck at and what is the code you have?
Mika Wendelius 18-Sep-15 13:40pm View
   
Modify the question to contain all the appropriate code. How have you wired the CheckedChange event etc.
Mika Wendelius 18-Sep-15 12:03pm View
   
It would help if you could you post an example scenario with sample data? Use the Improve question link to modify the question
Mika Wendelius 18-Sep-15 11:45am View
   
You can define an alias for all columns. Have a look at the modified example.

Another thing, don't post post comments or questions as new solutions. You can use the "Have a question or Comment?" button to submit new comments concerning a single solution :)
Mika Wendelius 18-Sep-15 2:34am View
   
As I wrote, it's best practice to do the formatting on the client side, but if you want to do the formatting in the SQL just modify the DATEPART and repeat it for all elements you want to show (hour, minute,day). So something like

CAST(DATEPART(HOUR, a.logouttime - a.logintime) AS nvarchar )
+ ':'
+ CAST(DATEPART(MINUTE, a.logouttime - a.logintime) AS nvarchar )
+ ':'
+ CAST(DATEPART(SECOND, a.logouttime - a.logintime) AS nvarchar )
Mika Wendelius 18-Sep-15 1:29am View
   
Have a look at the modified answer.
Mika Wendelius 18-Sep-15 1:13am View
   
Exactly!
Mika Wendelius 18-Sep-15 1:13am View
   
Thanks!
Mika Wendelius 16-Sep-15 23:54pm View
   
Mika Wendelius 15-Sep-15 7:44am View
   
Does the cursor Sam return 2 rows? If it does, it looks like your loop will be run twice thus running the statement with union twice.
Mika Wendelius 14-Sep-15 23:46pm View
   
As said a data source needs to be a collection of courses, not a single course. This is the reason why I wrote that the data source should probably contain several rows.

However, if you want to return only a single course and use that as a data source, modify the method to something like

public static List GetCourse(int id)

add the course to a list and in the end return the list.
Mika Wendelius 14-Sep-15 14:15pm View
   
You're welcome!
Mika Wendelius 14-Sep-15 14:12pm View
   
Please explain a bit more, what is it you're trying to do and if you get error messages, what are the exact messages.
Mika Wendelius 14-Sep-15 0:21am View
   
Without any delimiters I'd say this is quite risky. What if you have a product 090 and A3090F or products A109 and 030 and you query with A109030. I would consider some other approach.
Mika Wendelius 13-Sep-15 23:22pm View
   
Good eyes :)

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