Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
immad
Posting Yak Master
230 Posts |
Posted - 2013-07-19 : 03:16:43
|
helloi want to update a data in grid viewi have three columns in grid view first two column are shift id and date these two column are taken from table 1the third column is shift column this column are taken from table 2now i want to update a data where shift id and shift column are sametable 2 have these columnshiftshiftidand table 1 has these columnshift id,dateplease can u provide me a update query syntaxthanksimmad uddin ahmed |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-07-19 : 03:55:11
|
update which field? with what value?You just specfied criteria but did give us any information on column to be updated and value to be used------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
immad
Posting Yak Master
230 Posts |
Posted - 2013-07-19 : 05:54:57
|
quote: Originally posted by visakh16 update which field? with what value?You just specfied criteria but did give us any information on column to be updated and value to be used------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs
update shift column with shift id for exampleshift id------------shift---1-----------------A---2-----------------Bafter execute query data shows this resultshift id----------------shift----1--------------------C----2--------------------Bimmad uddin ahmed |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-07-19 : 06:25:20
|
Where does C ad B come from? They're not values present in shift id column so your statement below is incorrectupdate shift column with shift id ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
immad
Posting Yak Master
230 Posts |
Posted - 2013-07-19 : 06:37:48
|
I EXPLAIN U IN DETAILI AM MAKING A APPLICATION IN c# THERE IS A GRID THAT SHOWS SHIFT ID , SHIFT AND DATEUSER SEARCH DATE AND IN GRID DATE , SHIFT AND SHIFT ID SHOWSTHEN USER CHANGE SHIFT AND ON SHIFT TABLE THAT SHIFT NAME CHANGE OF THAT ID.SHIFT ID AND DATE COME FROM SHIFT DETAILS TABLETHIS IS A DATA SHIFT ID----------DATE-----1------------1/1/2013-----2------------2/1/2013-----3-----------4/5/2013-----4------------6/24/2013AND SHIFT COME FROM SHIFT TABLETHIS IS A DATA OF SHIFT TABLESHIFT ID----------SHIFT-----1------------A-----2------------B-----3-----------C-----4------------DWHEN USER EXECUTE UPDATE QUERY ITS CHANGES SHIFT COLUMN VALUE OF SHIFT TABLEI HOPE U UNDER STAND SIRONE THING MORE HE CAN ONLY CHANGE A SHIFT FROM THE GRID HE CANNOT CHANGE IDimmad uddin ahmed |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-07-19 : 06:51:49
|
sounds like this to mequery to serach and get shift detailsSELECT [DATE],SHIFT,SHIFTIDFROM TableWHERE [DATE]= @DateValue @Datevalue you pass from applicationNow when user edit a SHIFT you'll fire a query like thisUPDATE sSET s.SHIFT= @YourNewShiftValueFROM SHIFT sWHERE SHIFTID=@ShiftID Where @YourNewShiftValue will be tha value user changes in gridand @ShiftID will have id of the row that user modifies as its valueyou need to write code in C# to form the above sql queries in your c# code, pass them to db and execute ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|