Re: Connecting to SQL w/ADO



Connecting can be difficult in the best of circumstances. My new book (not
yet published) devotes about 70 pages (so far) to getting (and staying)
connected so a short answer probably won't help. Again, I suggest picking up
someone's book on ADO.NET--or come to one of the workshops I'm teaching in
the next 6 weeks.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"G." <noreply@xxxxxxxxxxx> wrote in message
news:krCdndz1V9Cg__beRVn-uA@xxxxxxxxxx
> Thanks William (Bill),
>
> I have tried to use "Provider=sqloledb;" and it hasn't worked either. I'm
> sure I'm missing something elementary. I'll read up at Carl Prothman's
> site
> again. I'm trying to connect to a local server from a local workstation
> (and
> only 1 workstation will run the app). I am not trying to connect to an
> Internet or MySQL server. Users must authenticate before they can run it.
> I'm not sure what the "SQL injection" is. I'll research that a little more
> as well. I'm uncertain whether that applies.
>
> Thanks,
> G.
>
>
>
> "William (Bill) Vaughn" <billvaRemoveThis@xxxxxxxxxx> wrote in message
> news:e9LIMTM4FHA.3400@xxxxxxxxxxxxxxxxxxxxxxx
>> Ah, I would not use the ODBC provider to access SQL Server. Use the
> SQLOLEDB
>> provider--it's designed specifically for SQL Server. See Carl Prothman's
>> site for connection strings. I would also read up on SQL injection. Your
>> application is a target-rich environment for such attacks. I suggest
> picking
>> up a book on ADO--I've written a few and all of which walk you through
>> the
>> issues.
>>
>> --
>> ____________________________________
>> William (Bill) Vaughn
>> Author, Mentor, Consultant
>> Microsoft MVP
>> INETA Speaker
>> www.betav.com/blog/billva
>> www.betav.com
>> Please reply only to the newsgroup so that others can benefit.
>> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>> __________________________________
>>
>> "G." <noreply@xxxxxxxxxxx> wrote in message
>> news:zMOdnZXWY5H2FffeRVn-pw@xxxxxxxxxx
>> > Hello all,
>> >
>> > I am trying to connect via ADO to our SQL Server backend, but it's not
>> > connecting. I am developing in VB6 SP5.
>> >
>> > The code I have is this (relevant to what I am trying to do):
>> > ===
>> > in (gen)(dec):
>> > Const PathToSQL = "Initial Catalog=VTIOE;Data Source=SQL"
>> > ...
>> > then in the command button that is going to search for the same record
>> > I
>> > have this:
>> > cnn.Open "DSN=SQL_VTIOE;User ID=" & gstrUser & ";Password=" &
>> > gstrPasswd
>> > & ";" & PathToSQL
>> > rst.Open "SELECT Order_No FROM Shipments WHERE Order_No LIKE '" &
>> > strOrderNo & "'", cnn, adOpenStatic
>> >
>> > When I run the code, it flags the cnn.Open line with several different
>> > errors (I tinkered with that line to try and persuade it to work).
>> >
>> > Sometimes I get a run-time -214721843 (login failed for user
>> > 'username')
>> > others, I get: run-time -2147467259 "Data Source name not found and no
>> > default driver specified."
>> >
>> > ??
>> >
>> > Can anyone help me out and let me know how I should be trying to
>> > connect
>> > to
>> > the server (SQL Server 2000)? I have connected to Access 2000 databases
>> > just
>> > fine in the past, but the SQL connection is new territory for me.
>> >
>> > Thanks, in advance, for any and all help!
>> > ~Gary
>> >
>> >
>> >
>>
>>
>
>
>


.