Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO Problems in VB6

Status
Not open for further replies.

ShawnCoutts

Programmer
Joined
Jul 4, 2006
Messages
74
Location
CA
I am trying to create some stored procedures with ADO, but i keep running into the problem that they are too long to fit on a single line in VB6. How can I create a multi line stored procdure for sql server with ADO?
 
I like to compose the stored procedure using the SQL Server Query Analyzer.
 
something like this:

queryStr = "select blah blah blah ..." + _
"more blah blah blah" + _ (up to 19 lines).

Then you can do it all over again:
queryStr = queryStr + "..."

and pass that to the ado command.

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
Um, why are you trying to create a stored proc dynamically using ado?
 
There can be many reasons for creating a stored proc from within ADO, but:


ShawnCoutts
Why do you want them to be on one line?

ArtieChoke
String concatination should be done using ampersand:

"a" + "b" == not recommended
"a" & "b" == recommended

Greetings,
Rick
 
String concatination should be done using ampersand:

Please don't "should" on me! :-)

IIRC, VB.Net doesn't support & and + looks a lot nicer to me - it's really a style thing. Since I'm aware all values are strings, it's no big deal.

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
>IIRC, VB.Net doesn't support &

IIRC, you recall incorrectly (although it is true that the StringBuilder class is more efficient)

And & is, according to some sources, theoretically more efficient than + in VB6 when concatenating strings, although my own timing exercises have never really confirmed this

One thing is definitely does, however, is remove any ambiguity

But each to his own

 
>There can be many reasons for creating a stored proc from within ADO...
Well, yes, but I still want to know why.
 
I completed missed the part about stored procedures. I thought he was talking about dynamic queries - doh!

Hey Shawn, you gonna come back here some time and let us know if anything worked for you?

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
Thanks for all the suggestions, I got it working now.
I basically just stored as much of the sp into a string variable as possible and concatenated them all together.
The queries all end up on one line in the sql query analyzer, its ugly but it works.
Thanks again

Shawn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top