Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Just using a SELECT statement instead of running query
Message
De
24/06/2011 16:08:04
 
 
À
24/06/2011 15:55:45
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01515946
Message ID:
01515954
Vues:
53
Replace cmd with

SELECT;
client_zip,;
bol_number,;
ref_num,;
weight,;
pro_number,;
customer_name,;
customer_state,;
customer_zip,;
carrier_name,;
ship_date,;
est_delivery,;
appt_date,;
latest_status_description,;
latest_reason_description,;
date_last_updated;
FROM sq;


>Correct, slip of the fingers, I do know that a SELECT is a type of query.
>
>Is that would I would do though, remove what's in the CMD and put the SELECT in there instead of below? I'll probably put it in a stored procedure later, but for now I just want to test the code and get that part working since I have a harder time with VFP than I do with SQL.
>
>>Hi James,
>>
>>Let's start with some definitons. A SELECT *is* a query. What you are asking is, "Just using a SELECT statement instead of calling a Stored Procedure"
>>
>>In theory, a Stored Procedure will be precompiled and run faster than issuing a SELECT statement. If you're going to run it over and over, you may notice a difference. If run on ocassion, it really won't matter much for a query as simple as the one you have.
>>
>>
>>>I have code that logs into a server and database and runs a SP from that database, but what would I have to take out if I just wanted to select fields from the same database instead?
>>>
>>>
FUNCTION r214input
>>>THESQLDB = "TBL_BL"	
>>>THESQLTABLE = "TBL_BOL"
>>>THESERVER = goWCServer.oConfig.oTask.cSQLServer
>>>usr = 
>>>pas = 
>>>ConnStr = [driver=SQL Server; server=]+THESERVER+[; database=]+THESQLDB+[; uid=]+usr+[;pwd=]+pas+[; Trusted_Connection=No;]
>>>curHandle = SQLstringCONNECT( connStr )
>>>cmd = [exec InTransit ?']+ALLTRIM(user.cclientcd)+[']
>>>lr = SQLEXEC( curHandle, cmd, "sq")  && sq is the cursor the data is loaded into
>>>
>>>SELECT;	
>>>	client_zip,;
>>>	bol_number,;
>>>	ref_num,;
>>>	weight,;
>>>	pro_number,;
>>>	customer_name,;
>>>	customer_state,;
>>>	customer_zip,;
>>>	carrier_name,;
>>>	ship_date,;
>>>	est_delivery,;
>>>	appt_date,;
>>>	latest_status_description,;
>>>	latest_reason_description,;
>>>	date_last_updated;
>>>	FROM sq;
>>>	INTO CURSOR TQuery
>>>	SELECT TQuery
>>>	SET CENTURY ON 
>>>	recs=RECCOUNT()
>>>
>>>Would I just replace what is already in CMD with the select statement?
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform