Click here to Skip to main content
15,881,669 members
Home / Discussions / C#
   

C#

 
GeneralRe: Ending session and back button after logout Pin
sahavasiwebwonders24-Jan-13 18:59
sahavasiwebwonders24-Jan-13 18:59 
QuestionTally Integration Pin
Atul Ankush Bhabal23-Jan-13 22:38
Atul Ankush Bhabal23-Jan-13 22:38 
AnswerRe: Tally Integration Pin
Pete O'Hanlon23-Jan-13 22:43
mvePete O'Hanlon23-Jan-13 22:43 
QuestionHow check if a record exists before running the code to delete the record? Pin
Member 964160223-Jan-13 22:37
Member 964160223-Jan-13 22:37 
AnswerRe: How check if a record exists before running the code to delete the record? Pin
dan!sh 23-Jan-13 22:57
professional dan!sh 23-Jan-13 22:57 
AnswerRe: How check if a record exists before running the code to delete the record? Pin
Richard MacCutchan23-Jan-13 23:01
mveRichard MacCutchan23-Jan-13 23:01 
AnswerRe: How check if a record exists before running the code to delete the record? Pin
Eddy Vluggen24-Jan-13 0:43
professionalEddy Vluggen24-Jan-13 0:43 
AnswerRe: How check if a record exists before running the code to delete the record? Pin
V.24-Jan-13 1:57
professionalV.24-Jan-13 1:57 
if you delete it while it doesn't exist SQL will return something like: "0 rows deleted".

SQL
Delete from tableX where myconstraint='Myconstraint';

--> query returned in 10 ms: 0 rows deleted


If you do it in code you can get that by reading out the NrOfRowsAffected property when doing an ExecuteNonQuery statement. Same goes for Insert and Update queries eg.
as someone already replied, checking if it exists is inaccurate at best and doesn't add any functional advantage.

if you really, really must check it. Perform a select query perhaps with a count.

SQL
Select count(id) from tableX where myconstraint='Myconstraint'

if count > 0 , the record exists.

hope this helps.

AnswerRe: How check if a record exists before running the code to delete the record? Pin
PIEBALDconsult24-Jan-13 4:40
mvePIEBALDconsult24-Jan-13 4:40 
AnswerRe: How check if a record exists before running the code to delete the record? Pin
pt140125-Jan-13 9:15
pt140125-Jan-13 9:15 
Questionneed the project code in c# Pin
Member 978198223-Jan-13 21:58
Member 978198223-Jan-13 21:58 
GeneralRe: need the project code in c# Pin
PIEBALDconsult23-Jan-13 22:01
mvePIEBALDconsult23-Jan-13 22:01 
AnswerRe: need the project code in c# Pin
Pete O'Hanlon23-Jan-13 22:18
mvePete O'Hanlon23-Jan-13 22:18 
AnswerRe: need the project code in c# Pin
pt140125-Jan-13 9:16
pt140125-Jan-13 9:16 
QuestionExasperated by MSMQ Pin
Ger Hayden23-Jan-13 21:52
Ger Hayden23-Jan-13 21:52 
AnswerRe: Exasperated by MSMQ Pin
Abhinav S23-Jan-13 22:34
Abhinav S23-Jan-13 22:34 
GeneralRe: Exasperated by MSMQ Pin
Ger Hayden24-Jan-13 2:51
Ger Hayden24-Jan-13 2:51 
GeneralRe: Exasperated by MSMQ Pin
Ger Hayden26-Jan-13 0:45
Ger Hayden26-Jan-13 0:45 
AnswerRe: Exasperated by MSMQ Pin
jschell24-Jan-13 8:45
jschell24-Jan-13 8:45 
GeneralRe: Exasperated by MSMQ Pin
Ger Hayden24-Jan-13 9:21
Ger Hayden24-Jan-13 9:21 
QuestionImporting Images onto Design Stage Pin
ASPnoob23-Jan-13 18:03
ASPnoob23-Jan-13 18:03 
AnswerRe: Importing Images onto Design Stage Pin
Eddy Vluggen24-Jan-13 0:40
professionalEddy Vluggen24-Jan-13 0:40 
Questionstring[] to Microsoft.Exchange.Data.MultiValuedProperty Pin
JD8623-Jan-13 12:22
JD8623-Jan-13 12:22 
AnswerRe: string[] to Microsoft.Exchange.Data.MultiValuedProperty Pin
Jibesh23-Jan-13 13:28
professionalJibesh23-Jan-13 13:28 
GeneralRe: string[] to Microsoft.Exchange.Data.MultiValuedProperty Pin
JD8625-Jan-13 3:41
JD8625-Jan-13 3:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.