Delete in mssql via Datagrid
Posted: Fri Dec 07, 2012 12:36 pm
Hey guys,
I've a problem with deleting data from my mssql database viĆ” a datagrid.
I want to delete the hilitedline of my datagrid and refresh the view. So that I
can see the updated version of it.
This is my code but it doesn't work maybe someone can help me
finding the mistake I made.
___________________________________________________________________________________________
global gDB
on mouseUp
answer warning "Are you sure that you want to delete this data?" with "No" or "Yes"
if it is "No" then
exit to top
end if
set the itemDelimiter to tab
put the dghilitedlines of group "dg1" into tNum
if tNum is "" then exit mouseUp
put the dgDataOfLine[tNum] of group "dg1" into theDataA
put theDataA["UserID"] into tUserID
put "DELETE FROM [xxxx].[xxxx].[xxxxx] WHERE UserID='" & tUserID into vSQL
put revdb_execute(gDB,vSQL) into vTmp
answer information "Successfully deleted."
put "SELECT xxxx,xxxx,xxxx,xxxx,xxxxx,xxxxx,xxxxx,xxxx FROM [xxxxx].[xxxx].[xxxxx]" into vSQL
put revDataFromQuery(Tab,Return,gDB,vSQL) into tRS
set the dgtext of group "dg1" to tRS
end mouseUp
___________________________________________________________________________________________
regards
Nibor
I've a problem with deleting data from my mssql database viĆ” a datagrid.
I want to delete the hilitedline of my datagrid and refresh the view. So that I
can see the updated version of it.
This is my code but it doesn't work maybe someone can help me
finding the mistake I made.
___________________________________________________________________________________________
global gDB
on mouseUp
answer warning "Are you sure that you want to delete this data?" with "No" or "Yes"
if it is "No" then
exit to top
end if
set the itemDelimiter to tab
put the dghilitedlines of group "dg1" into tNum
if tNum is "" then exit mouseUp
put the dgDataOfLine[tNum] of group "dg1" into theDataA
put theDataA["UserID"] into tUserID
put "DELETE FROM [xxxx].[xxxx].[xxxxx] WHERE UserID='" & tUserID into vSQL
put revdb_execute(gDB,vSQL) into vTmp
answer information "Successfully deleted."
put "SELECT xxxx,xxxx,xxxx,xxxx,xxxxx,xxxxx,xxxxx,xxxx FROM [xxxxx].[xxxx].[xxxxx]" into vSQL
put revDataFromQuery(Tab,Return,gDB,vSQL) into tRS
set the dgtext of group "dg1" to tRS
end mouseUp
___________________________________________________________________________________________
regards
Nibor