I cannot help with c#, but with DAO and VBA you have:
For Each qdf In CurrentDB.QueryDefs
'~* are system queries for data for forms, controls etc'
If Left(qdf.Name,1) <>"~" Then
s = qdf.SQL
End If
Next
You can also look at the system tables MsysObjects and MsysQueries, but that might be a little tedious.
Then there are ADO schemas, for example, this would list select queries:
Sub ListQueriesAdo()
Dim rs As ADODB.Recordset
Set rs = CurrentProject.Connection.OpenSchema( _
adSchemaViews, Array(Empty, Empty, Empty))
For i = 0 To rs.Fields.Count - 1
Debug.Print rs.Fields(i).name
Next
Do While Not rs.EOF
Debug.Print rs!VIEW_DEFINITION
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
End Sub
And you can use adSchemaProcedures to show action queries.
Finally, you can use a catalog:
Private Sub ListQueriesCat()
Dim cn As ADODB.Connection
Dim mcat As ADOX.Catalog
Dim mview As ADOX.View
Dim cmd As ADODB.Command
Set cn = CurrentProject.Connection
Set mcat = New ADOX.Catalog
Set mcat.ActiveConnection = cn
For Each mview In mcat.Views
Debug.Print mview.Command.CommandText
Next
Set mview = Nothing
Set cmd = Nothing
Set mcat = Nothing
cn.Close
End Sub