more concise?

T

Todos Menos [MSFT]

hey guys

I can't figure out why this first statement is so much shorter than
the 2nd one

Dim strSql As String

strSql = "EXEC " & QryName & "@BegDate= '" & BegDate & "',
@EndDate='" & EndDate & "'"
DoCmd.RunSQL strSql

Dim MyQuery As QueryDef

Set MyQuery = MyDB.QueryDefs(QryName)
MyQuery.Parameters("BegDate") = BegDate
MyQuery.Parameters("EndDate") = EndDate
MyQuery.Execute


Any ideas?

Thanks

-Todos
 
D

David Conger [MSFT]

The two statements aren't really the same. While they may have the same
outcome, one is DAO and the other is SQL...they simply have a different
syntax.

You could make the first statement more like the second if you wanted...

Dim strSql As String

strSql = "EXEC " & QryName
strSql = strSql + "@BegDate= '" & BegDate & "',"
strSql = strSql + "@EndDate='" & EndDate & "'"

DoCmd.RunSQL strSql

--
David Conger
Software Development Engineer in Test
Microsoft Office Access

** This posting is provided "AS IS" with no warranties, and confers no
rights. **
 
T

Todos Menos [MSFT]

I just don't understand why people use the 2nd option

the first option is SOOOOO much clearer, in my opinion

Do people really still use Jet?? Why?

-Todos
 
T

Todos Menos [MSFT]

a different syntax?

it looks to me like the DAO is a MORE VERBOSE syntax.. is that a good
generalization?

ADO is faster than DAO for SQL Server.. right?

-Todos
 
D

David Conger [MSFT]

Anyone that uses Access (pre-2007) to build their database is using Jet. I
would argue that the second option is clearing. Combing variables into
strings to create a SQL statement is messy. There are so many &'s and
quotes, it is easy to miss something. The DAO code is much more defined.
SqlCommands in C# do exactly the same thing. Sure, it you write a couple
more lines of code, but it makes things very easy to read and very easy to
verify.

--
David Conger
Software Development Engineer in Test
Microsoft Office Access

** This posting is provided "AS IS" with no warranties, and confers no
rights. **
 
T

Todos Menos [MSFT]

you're full of crap kid

I've been using Access every day for 10 years and I haven't used JET
once
it's called Access Data Projects

if you use Access and you don't do ADP you should be fired

And seriously.. C#? What the HELL are you talking about kid.. C# was
never invented..
and C# sure doesn't show up under Tools, Macros, C# editor ROFL

-Todos
 
D

David Conger [MSFT]

Defining SQL into a string and executing vs. using ADO/DAO (or the like) are
totally different. Sure, DAO is "more verbose," but also isn't a query
language like defining a SQL statement and passing it to the database
engine.

--
David Conger
Software Development Engineer in Test
Microsoft Office Access

** This posting is provided "AS IS" with no warranties, and confers no
rights. **
 
D

David Conger [MSFT]

As you said yourself...ADPs aren't databases, they are projects ;-). My
statement was only that people using Access to build databases are using
Jet. If you are using a project your building a SQL database.

--
David Conger
Software Development Engineer in Test
Microsoft Office Access

** This posting is provided "AS IS" with no warranties, and confers no
rights. **

Todos Menos said:
you're full of crap kid

I've been using Access every day for 10 years and I haven't used JET
once
it's called Access Data Projects

if you use Access and you don't do ADP you should be fired

And seriously.. C#? What the HELL are you talking about kid.. C# was
never invented..
and C# sure doesn't show up under Tools, Macros, C# editor ROFL

-Todos




Anyone that uses Access (pre-2007) to build their database is using Jet.
I
would argue that the second option is clearing. Combing variables into
strings to create a SQL statement is messy. There are so many &'s and
quotes, it is easy to miss something. The DAO code is much more defined.
SqlCommands in C# do exactly the same thing. Sure, it you write a couple
more lines of code, but it makes things very easy to read and very easy
to
verify.

--
David Conger
Software Development Engineer in Test
Microsoft Office Access

** This posting is provided "AS IS" with no warranties, and confers no
rights. **

message

I just don't understand why people use the 2nd option
the first option is SOOOOO much clearer, in my opinion
Do people really still use Jet?? Why?

On Mar 14, 2:25 pm, "David Conger [MSFT]"
The two statements aren't really the same. While they may have the
same
outcome, one is DAO and the other is SQL...they simply have a
different
syntax.
You could make the first statement more like the second if you
wanted...
Dim strSql As String
strSql = "EXEC " & QryName
strSql = strSql + "@BegDate= '" & BegDate & "',"
strSql = strSql + "@EndDate='" & EndDate & "'"
DoCmd.RunSQL strSql
** This posting is provided "AS IS" with no warranties, and confers no
rights. **
I can't figure out why this first statement is so much shorter than
the 2nd one
Dim strSql As String
strSql = "EXEC " & QryName & "@BegDate= '" & BegDate & "',
@EndDate='" & EndDate & "'"
DoCmd.RunSQL strSql
Dim MyQuery As QueryDef
Set MyQuery = MyDB.QueryDefs(QryName)
MyQuery.Parameters("BegDate") = BegDate
MyQuery.Parameters("EndDate") = EndDate
MyQuery.Execute
Any ideas?

-Todos- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -
 
D

Dirk Goldgar

In
Todos Menos said:
hey guys

I can't figure out why this first statement is so much shorter than
the 2nd one

Dim strSql As String

strSql = "EXEC " & QryName & "@BegDate= '" & BegDate & "',
@EndDate='" & EndDate & "'"
DoCmd.RunSQL strSql

Dim MyQuery As QueryDef

Set MyQuery = MyDB.QueryDefs(QryName)
MyQuery.Parameters("BegDate") = BegDate
MyQuery.Parameters("EndDate") = EndDate
MyQuery.Execute


Any ideas?

My idea is that Aaron Kempf is trolling again.
 
T

Todos Menos [MSFT]

just because I'm RIGHT and you're a flaming MDB wuss; does that give
you room to bitch?

I don't see your side of the argument

you're a fucking con artist.. delivering solutions that are hard to
scale

I can build ADP faster than you can MDB, kid
 
Top