Changing CommandText changes Parameters
-
I'm trying to edit the CommandText for the Insert Command in a TableAdapter in the Designer in vb.net. Whenever I make changes to the CommandText, Visual Studio (2008) automagically changes the Parameters to a Collection consisting of one Parameter that existed before editing the Command, immersed in a sea of complete garbage Parameters, and then I either have to undo (unless this was the first thing I tried editing, in which case I have to close the Designer to discard changes and reopen it) or manually change ALL the Parameters back to something that isn't complete garbage. Has anybody seen anything like this, or know how to stop Visual Studio from murdering my carefully tended Parameters? Any way to change the CommandText without finding yet another reason to curse the name of M$ would be greatly appreciated.
-
I'm trying to edit the CommandText for the Insert Command in a TableAdapter in the Designer in vb.net. Whenever I make changes to the CommandText, Visual Studio (2008) automagically changes the Parameters to a Collection consisting of one Parameter that existed before editing the Command, immersed in a sea of complete garbage Parameters, and then I either have to undo (unless this was the first thing I tried editing, in which case I have to close the Designer to discard changes and reopen it) or manually change ALL the Parameters back to something that isn't complete garbage. Has anybody seen anything like this, or know how to stop Visual Studio from murdering my carefully tended Parameters? Any way to change the CommandText without finding yet another reason to curse the name of M$ would be greatly appreciated.
I expect that's what it's supposed to do. Never use a DataAdapter / TableAdapter -- they are too much trouble for real work.
-
I'm trying to edit the CommandText for the Insert Command in a TableAdapter in the Designer in vb.net. Whenever I make changes to the CommandText, Visual Studio (2008) automagically changes the Parameters to a Collection consisting of one Parameter that existed before editing the Command, immersed in a sea of complete garbage Parameters, and then I either have to undo (unless this was the first thing I tried editing, in which case I have to close the Designer to discard changes and reopen it) or manually change ALL the Parameters back to something that isn't complete garbage. Has anybody seen anything like this, or know how to stop Visual Studio from murdering my carefully tended Parameters? Any way to change the CommandText without finding yet another reason to curse the name of M$ would be greatly appreciated.
Parameters are build based on CommandText. So if you are going to change command text, you would need to change the parameters as well.
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
Visit My Website-->**
-
Parameters are build based on CommandText. So if you are going to change command text, you would need to change the parameters as well.
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
Visit My Website-->**
Not always, I can have parameters set up according to the columns of a particular table and then wish to set the command as appropriate for a task and not need to alter the Parameters collection. But to do that I need to roll my own -- which I do.
-
I'm trying to edit the CommandText for the Insert Command in a TableAdapter in the Designer in vb.net. Whenever I make changes to the CommandText, Visual Studio (2008) automagically changes the Parameters to a Collection consisting of one Parameter that existed before editing the Command, immersed in a sea of complete garbage Parameters, and then I either have to undo (unless this was the first thing I tried editing, in which case I have to close the Designer to discard changes and reopen it) or manually change ALL the Parameters back to something that isn't complete garbage. Has anybody seen anything like this, or know how to stop Visual Studio from murdering my carefully tended Parameters? Any way to change the CommandText without finding yet another reason to curse the name of M$ would be greatly appreciated.
There is a reason why you are getting limited help on this subject, very few experienced devs will use the table adapters. They are one of the worst things MS has inflicted on us, they allow a new developer to get data to the UI with almost no knowledge of how it was achieved. Look into buiding or implementing a data access layer DAL. This will give you much greater knowledge and therefore control over your data.
Never underestimate the power of human stupidity RAH
-
Parameters are build based on CommandText. So if you are going to change command text, you would need to change the parameters as well.
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
Visit My Website-->**
-
There is a reason why you are getting limited help on this subject, very few experienced devs will use the table adapters. They are one of the worst things MS has inflicted on us, they allow a new developer to get data to the UI with almost no knowledge of how it was achieved. Look into buiding or implementing a data access layer DAL. This will give you much greater knowledge and therefore control over your data.
Never underestimate the power of human stupidity RAH
Mycroft Holmes wrote:
worst things MS has inflicted on us, they allow a new developer to get data to the UI with almost no knowledge of how it was achieved.
And this is a bad thing why? Anyway, the problem is not that I don't know what I'm doing. I know exactly what it should look like, and know that if I can get the screen to look like this, it will work as expected. The internals of the Table Adapter are not the problem; the problem is the Designer changing parameters without my permission. If you don't know how to convince the UI to not drop data, man up and confess your ignorance rather than using it as an excuse to make yourself sound like an elitist snob. That does nobody any good, and makes you look stupid. Allow me to demonstrate:
Bad:
HAHAHAHA!!!! LOSER!!!! ONLY N000BS USE M$ COMPONENTS!!!! ROLL YOUR OWN N0000B!!!!1111ONEONE
Good:
Oooh, sorry, I never use TableAdapters, I've never had anything but problems with them, and in my experience, most people around here feel the same. Have you considered making your own or implementing one from somewhere else? It always seems to work out easier for me in the long run.
You see the difference? They both offer the same advice, but the second one actually comes across as advice rather than an elitist slam. ---- All ranting aside, I do appreciate your advice, and while it doesn't look like implementing some other solution is an immediately viable solution (I'm not the only person in this code, and the senior programmer who originally implemented this would seem to take offense at the idea that he has no idea what he's doing), I will keep it in mind should I come across database needs more complex than can be solved through whatever it takes to get this UI in line (which looks like my only option might be to let VS destroy my Parameters and then manually rewrite them all.... sigh....)
-
Mycroft Holmes wrote:
worst things MS has inflicted on us, they allow a new developer to get data to the UI with almost no knowledge of how it was achieved.
And this is a bad thing why? Anyway, the problem is not that I don't know what I'm doing. I know exactly what it should look like, and know that if I can get the screen to look like this, it will work as expected. The internals of the Table Adapter are not the problem; the problem is the Designer changing parameters without my permission. If you don't know how to convince the UI to not drop data, man up and confess your ignorance rather than using it as an excuse to make yourself sound like an elitist snob. That does nobody any good, and makes you look stupid. Allow me to demonstrate:
Bad:
HAHAHAHA!!!! LOSER!!!! ONLY N000BS USE M$ COMPONENTS!!!! ROLL YOUR OWN N0000B!!!!1111ONEONE
Good:
Oooh, sorry, I never use TableAdapters, I've never had anything but problems with them, and in my experience, most people around here feel the same. Have you considered making your own or implementing one from somewhere else? It always seems to work out easier for me in the long run.
You see the difference? They both offer the same advice, but the second one actually comes across as advice rather than an elitist slam. ---- All ranting aside, I do appreciate your advice, and while it doesn't look like implementing some other solution is an immediately viable solution (I'm not the only person in this code, and the senior programmer who originally implemented this would seem to take offense at the idea that he has no idea what he's doing), I will keep it in mind should I come across database needs more complex than can be solved through whatever it takes to get this UI in line (which looks like my only option might be to let VS destroy my Parameters and then manually rewrite them all.... sigh....)
Trevortni wrote:
man up and confess your ignorance rather than using it as an excuse to make yourself sound like an elitist snob.
I thought it was rather obvious that I didn't have the answer, the reason I waited to see if somone else had come up with something more constructive.
Trevortni wrote:
senior programmer who originally implemented this
I'm astonished a senior dev would be using table adaptors, I would not allow that on any project I was involved in and would question the devs claim to seniority. Also this probably would have got a better response in the C#/VB forum as it really is the UI code misbehaving. Do take a look at some of the articles here as there are some excellent DALs available in them.
Never underestimate the power of human stupidity RAH
-
Yes, I understand this, and I am quite fine with this. The problem is, VS changes the Parameters for me, instead of giving me the option to specify the Parameters myself.
Trevortni wrote:
VS changes the Parameters for me
No it doesn't; the CommandBuilder does.
-
Trevortni wrote:
man up and confess your ignorance rather than using it as an excuse to make yourself sound like an elitist snob.
I thought it was rather obvious that I didn't have the answer, the reason I waited to see if somone else had come up with something more constructive.
Trevortni wrote:
senior programmer who originally implemented this
I'm astonished a senior dev would be using table adaptors, I would not allow that on any project I was involved in and would question the devs claim to seniority. Also this probably would have got a better response in the C#/VB forum as it really is the UI code misbehaving. Do take a look at some of the articles here as there are some excellent DALs available in them.
Never underestimate the power of human stupidity RAH
Mycroft Holmes wrote:
it really is the UI code misbehaving
I doubt that very much. It's the DataAdapter and CommandBuilder (and probably Clippy) trying to be helpful.
-
Mycroft Holmes wrote:
it really is the UI code misbehaving
I doubt that very much. It's the DataAdapter and CommandBuilder (and probably Clippy) trying to be helpful.
PIEBALDconsult wrote:
It's the DataAdapter and CommandBuilder
Sure but they are in the UI and in C#/VB rather than the database.
Never underestimate the power of human stupidity RAH
-
PIEBALDconsult wrote:
It's the DataAdapter and CommandBuilder
Sure but they are in the UI and in C#/VB rather than the database.
Never underestimate the power of human stupidity RAH
They have nothing to do with the UI; there are no visible parts, they do the same thing when I write a library with a text editor.
-
I expect that's what it's supposed to do. Never use a DataAdapter / TableAdapter -- they are too much trouble for real work.
That is why i dont use wizards to do my Data Layer
Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/
-
That is why i dont use wizards to do my Data Layer
Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/
Nor do I. :thumbsup: