July 10, 2005 at 5:51 pm
Hello all,
This is the your Frequent Flyer Newbie.
I have been working on this datagrid issue now for about 4 days (Learning how to insert and edit) And to put it lightly, it is not an easy task, Anyway i have finally got it under control. I know this because i am now getting a database error. And that error would be------------>
Could someone please be so kind to step up to the plate and show me how to turn the identity_insert to ON???
Thanks alot in advance!
Erik......
Dam again!
July 10, 2005 at 6:09 pm
Forgot to add the querry...
=============================================
ALTER PROCEDURE
SprocProductRestrictions
@IDProductRestrictions
INT,
@IDProduct
INT ,
@MaximumWidth
VARCHAR(3800),
@MaximumLength
VARCHAR (3800),
@MinimumWidthForLiftTilt
VARCHAR(3800),
@InsideMount
VARCHAR(3800),
@OutsideMount
VARCHAR(3800),
@ControlTilt
VARCHAR(3800),
@StackingFormulas
VARCHAR(3800),
@RestrictFive
VARCHAR(3800),
@RestrictSix
VARCHAR(3800),
@RestrictSeven
VARCHAR(3800),
@RestrictEight
VARCHAR(3800),
@RestrictNine
VARCHAR(3800),
@RestrictTen
VARCHAR(3800),
@RestrictEleven
VARCHAR(3800),
@RestrictTwelve
VARCHAR(3800)
AS
Insert
INTO ProductRestrictions (ProductRestrictionsID, ProductID, MaximumWidth, MaximumLength, MinimumWidthForLiftTilt, InsideMount, OutsideMount, ControlTilt,
StackingFormulas, RestrictFive, RestrictSix, RestrictSeven, RestrictEight, RestrictNine, RestrictTen, RestrictEleven,
RestrictTwelve)
VALUES
(@IDProductRestrictions, @IDProduct, @MaximumWidth, @MaximumLength, @MinimumWidthForLiftTilt, @InsideMount, @OutsideMount, @ControlTilt,
@StackingFormulas, @RestrictFive, @RestrictSix, @RestrictSeven, @RestrictEight, @RestrictNine, @RestrictTen, @RestrictEleven,
@RestrictTwelve)
Dam again!
July 10, 2005 at 7:32 pm
One of your fields is an identity field. Typcially you leave that field out of the insert () list and do not insert a value for it in the VALUEs clause. In other words, pretend that it does not exist.
If you want to insert a specific value, and be sure that you do want to, then you use
SET IDENTITY_INSERT tablename ON
before the insert and use the same code with OFF after your code.
July 10, 2005 at 7:40 pm
Thank you for the quick reply..
Thank you for letting me know that, because i am not interested in changing the ID columun.
ERIK....
Dam again!
July 10, 2005 at 9:18 pm
This is weird, At first i did not think that i was getting an insert into the database, and i happend to scroll down and low and behold i have about 30 inserts that were appended to the end and did not even realize it. The reason that i did not notice is because when i edited the row and pressed updata the row stayed the same so i was in beliefe that the row was never alterd. However, at the end of the table (datagrid) was about 30 entrys, but they had been duplicated and not updataed , or at lease that is what i thought updataed ment, that is to alter the existing data and return it back the row it was orgionally in. And what this is doing is making a copy of the data along with the alterations that i have made to the (so called base row) almose like it is creating a sub row (if there is a such).,
Does anyone have an answer for this or is this a vb.net question?
Erik...
Dam again!
July 10, 2005 at 9:50 pm
Never mind i found out what i am doing. I AM Doing a insert.
Dam again!
July 11, 2005 at 10:37 pm
Remember that the DataGrid needs to be "re-bound" to the datasource if you are doing any alterations to the base data. This is why the 30-odd records are showing up later.
July 11, 2005 at 10:42 pm
I found that out the hard way, i tried to put the dategrid off as long as possiable, but i had to finally fase it and i have just about got a worked able on it, other that having issues with getting nulls to insert and datetime..
Erik....
Dam again!
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply