Click here to Skip to main content
15,890,438 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: The shortest way to do this ? Pin
PIEBALDconsult2-Jun-15 15:49
mvePIEBALDconsult2-Jun-15 15:49 
GeneralRe: The shortest way to do this ? Pin
satc2-Jun-15 15:58
satc2-Jun-15 15:58 
GeneralRe: The shortest way to do this ? Pin
PIEBALDconsult2-Jun-15 16:07
mvePIEBALDconsult2-Jun-15 16:07 
GeneralRe: The shortest way to do this ? Pin
satc2-Jun-15 16:11
satc2-Jun-15 16:11 
GeneralRe: The shortest way to do this ? Pin
PIEBALDconsult2-Jun-15 18:07
mvePIEBALDconsult2-Jun-15 18:07 
GeneralRe: The shortest way to do this ? Pin
Mycroft Holmes2-Jun-15 20:38
professionalMycroft Holmes2-Jun-15 20:38 
GeneralRe: The shortest way to do this ? Pin
PIEBALDconsult3-Jun-15 12:39
mvePIEBALDconsult3-Jun-15 12:39 
GeneralRe: The shortest way to do this ? Pin
Richard Deeming2-Jun-15 22:11
mveRichard Deeming2-Jun-15 22:11 
Something like this should work:
VB.NET
Using transaction As DbContextTransaction = yourContext.Database.BeginTransaction()
    
    Const query As String = "SELECT N'DELETE FROM ' + QUOTENAME(A.[name]) + N'.' + QUOTENAME(B.[name]) + N' WHERE ' + QUOTENAME(C.[name]) + N' = 1' As CommandText FROM sys.schemas As A INNER JOIN sys.objects As B ON B.schema_id = A.schema_id INNER JOIN sys.columns As C ON C.object_id = B.object_id INNER JOIN sys.types As D ON D.system_type_id = C.system_type_id WHERE A.[schema_id] != 4 And B.[type] = 'U' And C.[name] = 'ToDelete' And D.[name] = 'bit';"
    
    Dim commandsToExecute As List(Of String) = context.Database.SqlQuery(Of String)(query).ToList()
    For Each command As String In commandsToExecute
        yourContext.Database.ExecuteSqlCommand(command)
    Next
    
    transaction.Commit()
End Using


Entity Framework : Raw SQL Queries[^]



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: The shortest way to do this ? Pin
satc2-Jun-15 23:35
satc2-Jun-15 23:35 
GeneralRe: The shortest way to do this ? Pin
Richard Deeming3-Jun-15 0:20
mveRichard Deeming3-Jun-15 0:20 
QuestionI can't solve following coding~~~ Pin
Wathon Aung2-Jun-15 1:24
Wathon Aung2-Jun-15 1:24 
AnswerRe: I can't solve following coding~~~ Pin
Chris Quinn2-Jun-15 2:24
Chris Quinn2-Jun-15 2:24 
GeneralRe: I can't solve following coding~~~ Pin
Wathon Aung2-Jun-15 21:32
Wathon Aung2-Jun-15 21:32 
GeneralRe: I can't solve following coding~~~ Pin
Richard MacCutchan2-Jun-15 21:34
mveRichard MacCutchan2-Jun-15 21:34 
AnswerRe: I can't solve following coding~~~ Pin
Dave Kreskowiak2-Jun-15 4:32
mveDave Kreskowiak2-Jun-15 4:32 
GeneralRe: I can't solve following coding~~~ Pin
Wathon Aung8-Jul-15 23:34
Wathon Aung8-Jul-15 23:34 
SuggestionRe: I can't solve following coding~~~ Pin
Richard Deeming2-Jun-15 21:54
mveRichard Deeming2-Jun-15 21:54 
QuestionChange Color of VSFlex Grid's Scroll Bar Pin
Mi Khayae Thin1-Jun-15 22:41
Mi Khayae Thin1-Jun-15 22:41 
QuestionHow to call the URL in wcf Pin
K Arunraj1-Jun-15 20:44
K Arunraj1-Jun-15 20:44 
AnswerRe: How to call the URL in wcf Pin
Dave Kreskowiak2-Jun-15 2:41
mveDave Kreskowiak2-Jun-15 2:41 
QuestionMissing parameter value Pin
Member 1172701428-May-15 22:00
Member 1172701428-May-15 22:00 
AnswerRe: Missing parameter value Pin
Simon_Whale28-May-15 23:04
Simon_Whale28-May-15 23:04 
AnswerRe: Missing parameter value Pin
Chris Quinn29-May-15 3:19
Chris Quinn29-May-15 3:19 
Questionprinting datagridview Pin
Member 1172695728-May-15 20:50
Member 1172695728-May-15 20:50 
AnswerRe: printing datagridview Pin
Richard MacCutchan28-May-15 22:12
mveRichard MacCutchan28-May-15 22:12 

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.