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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL views using SQLSTRINGCONNECT() 2

Status
Not open for further replies.

Guntruck

Programmer
Mar 29, 2001
25
US

I am trying to create a SQL that uses JUST a SQLSTRINGCONNECT() to access the SQL server. I cant open the view when I dont have a connection inculded with the project. this is the code im trying to use for now...

store SQLSTRINGCONNECT("driver={SQL SERVER};SERVER=localhost;UID=sa;PWD=pass;DATABASE=table;Trusted_Connection=No");
to sqlserver

open database view
use remoteview
tableupdate()

It fails when it trys to execute use remoteview because it cant find the connection..

ive also tried

sqlserver = SQLSTRINGCONNECT("driver={SQL SERVER};SERVER=localhost;UID=sa;PWD=pass;DATABASE=table;Trusted_Connection=No")

which also does not work.. how do you make it so the view can see the connection created with sqlstringconnect??
 
Hi my friend,
It is just advice, keep your data layer separate from Fox as much as you can, use ADO instead, it is really powerful enough. God knows what is Microsoft planning for FoxPro, if they will going to trash it at least you can save some of your efforts.
Good luck
Walid Magd
Engwam@Hotmail.com
 

Psh i sure wish I know how to implement/what ADO is.. i know ASP uses it... wanna point me to some resources??

I have 12 days to figure this out and turn it into a working sample... so im kinda freakin out over here never doing this before.


dave
 
Well, my friend
ADO in the most basic level is a COM object sitting very comfortably on Bill Gates lap. It is what is Microsoft insisted to call “The universal data access method” and it is the best since sliced the bread.
Anyways, the good news is, this is not a pure vapor, it works and it works very well.
All you need to do is to understand the basic level of this component and familiarize your self with some example about how to use it then, every one is happy.
To read about this guy, the first source (guess what) MSDN of course
Go to In the high right corner click support, Knowledge Base.
In My search is about select Visual FoxPro.
In I want to search by select, Key Word Search.
In My Question is type, guess what, ADO
WOW, too many articles to read, well have fun.
By the way 12 days is more than enough to understand it and have it up and running, the good news is -as Microsoft said so many times- ADO is completely taken from FoxPro cursor, so for the Fox developer and specially for Fox developers, the idea is not strange or unfamiliar. The RecordSet is a cursor and all the properties of it we already know about it and know why we need it like RecordSet .RecordCount.
Sure you already know what is this method and what it is suppose to return for you, right.
Go ahead and do it, if you need more resources beside what you already have in MSDN.
Try to search by the key word ADO in this forum or in Good luck

Walid Magd
Engwam@Hotmail.com
 
Guntruck, persistent remote views (those stored in a DBC) require a persistent named connection stored in the DBC. So, unfortunately (and I've wrestled with this for a long time) you can't programmatically create a connection on the fly and use it for an existing remote view (well, you can, but its more work than its worth).

But, the good news is that you can create a named connection using a connection string - you don't need to create a DSN. Robert Bradley
teaser.jpg

 
Well, darn. Because thats exactly what I wanted to do. It looks like im going to use this ado stuff insted.


dave
 
Walid,

I'm glad this came up, because I've got a project where I need to insert some records into a SQL 7 database from FoxPro and talking this morning to the programmer in Florida who maintains it, we were told not to use the database container but connect using ADO. Unfortunately, the FoxPro help files don't say much of anything about it. So I was going to go searching here, UT and MS for info. Glad to hear there's a lot available.

BTW, how does ADO relate to ODBC?

Dave Dardinger
 
Read John V. Petersen's intro to ADO from a VFP perspective:

ADO Jumpstart for Microsoft Visual FoxPro Developers

AFA your question regarding how ADO relates to ODBC, it's covered in depth at the very beginning of JVP's article. Jon Hawkins

The World Is Headed For Mutiny,
When All We Want Is Unity. - Creed
 
I read the article entirely. Very interesting, yet I'm still highly confused. For one, I am trying to connect to my SQL 2000 server WITH NO ODBC DSN. I am trying to connect with a string so I can load alternate SQL servers and or usernames/passwd's for those servers at runtime. ADO seems to be for connecting with DSN's. I know there is a way to create SYStem DSN's on the fly programatically, although i do not know how. Do I need to do this? Additionally, what is RDS? The article explains how to use it. But not what it is. It seems to allow for a direct connection. And in the diagram for ADO it shows that you can bypass using ODBC.. but how?


Dave

 
Hi my friend
ADO is not just for connection using DSN actualy the reverse is true, most of the ADO programmers don't like pre-defined DNSs. I am away of may computer now so it is hard for me to send you the correct syntax for the connection string. I will do this first thing in the mornnig
RDS is an COM component, its functionaly is the same as ADO,
connect to data source, return recordset, but it uses the internet as transportation media meannig it uses HTTP high way to travel not LAN or WAN. Walid Magd
Engwam@Hotmail.com
 


Thanks, ya I coudlnt seem to find ONE example that didnt use a DSN. I really appreciate it. Is there any advantage of using ADO or RDS?? How does RDS connect to the SQL server through the webserver?? Actually nevermind, ADO is obviously the way to go.



Thanks again.

dave
 
Ok, sorry for posting all this stuff and then changeing my mind. I have ADO working with a DNS-less connection string. I can access data. With something like
orecordset.Fields("id").Value ok? How could i take this record and slap it onto a grid? I've tried just setting the data type of the grid to alias.. and just putting the record object as the data source. The grid comes up doesnt complaign about the ojbect not being there, but still no data comes up? whats the deal?



Dave
 
The grid comes up doesnt complaign about the ojbect not being there, but still no data comes up? whats the deal?

Is this one of these cases where you need to set the recordsource type dynamically after everything is up and running instead of setting it in the design stage? Seems to me there are a couple of threads floating around here on the subject. --Dave



 
Sorry just one more thing, now that im using ADO how do I know what data types can go in which SQL fields?? i know theres a .type and .DefinedSize properties.. but the .type is a number? Where can i find the conversion??

dave
 
In regards to the grid issue and the RDS inquiry:
ADOCtl.Exe Demonstrates Active Documents, RDS and ADO

You can use VB's object browser to explore the ADO type library. See my post on Oct. 20, 2000 in Thread184-28224 for an example of how to use it. FYI - the reference is Microsoft ActiveX Data Objects N.n Library where N.n represents the version. Jon Hawkins

The World Is Headed For Mutiny,
When All We Want Is Unity. - Creed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top