Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WestWind/database filter help
Message
From
27/06/2011 12:02:39
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
WestWind/database filter help
Miscellaneous
Thread ID:
01516279
Message ID:
01516279
Views:
151
I have an HTML form that has a textbox and a search button. I want to be able to enter a number, have it search through an SQL database/table, and display the selected fields in a table below the textbox. I'm having trouble doing that with SQL though, I've done something similar with a FoxPro DB but can't quite figure out the differences in code.

So far I have this:
FUNCTION r214input

fdPrNo = ALLTRIM(UPPER(Request.Form("PRNO")))
fdBN   = Request.Form("BN")
fdPK   = Request.Form("PK")
mEr = ""
lcTable=""
m.protbl = ""
m.rplen = 0

DO CASE
CASE ! EMPTY(fdBN)
	SQLWhere = "BN=" + ALLTRIM(fdBN)
	IF ! EMPTY(fdPK)
		SQLWhere = SQLWhere + " AND PK=" + ALLTRIM(fdPK)
	ENDIF 
OTHERWISE
	lcTable = "Not Found" 
	Response.Expandtemplate(goWCServer.oConfig.oTask.cHtmPath+"r214input.htm")
	RETURN 
ENDCASE 
lcTable="TBL Master File<br>"

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 )
SELECT; 
bol_number,;
pro_number,;
client_city,;
client_state,;
client_zip,;
customer_city,;
customer_state,;
customer_zip,;
ship_date;
FROM THESQLTABLE;
into cursor 214
SELECT 214

loSC = CREATEOBJECT("wwShowCursor")
loSC.lCenterTable = .f.
loSC.cHeaderBGColor = "black"   &&"#336633"
loSC.lAlternateRows = .T.
	loSC.cAlternatingBGColor = "white"  &&"#EFEFEF"
loSC.cTableBorder ="3"
loSC.cTableWidth="750"
DIMENSION laHeaders[10]
laHeaders[1] = "BOL"
laHeaders[2] = "PRO"
laHeaders[3] = "Ref#"
laHeaders[4] = "oci"
laHeaders[5] = "ost"
laHeaders[6] = "ozp"
laHeaders[7] = "dci"
laHeaders[8] = "dst"
laHeaders[9] = "dzp"
laHeaders[10] = "Ship Date"
loSC.BuildFieldListHeader(@laHeaders)
loSC.lSumNumerics = .t.
loSC.ShowCursor()
lctable=loSC.GetOutput()
 

Response.ExpandTemplate(goWCServer.oConfig.oTask.cBTSHTMPath+"r214List.htm")
It keeps popping up and asking me which FoxPro DB I want to open, so it's not even seeing the SQL stuff I guess.

Would I be able to put something in a WHERE clause that basically says "WHERE pro_number = fdPrNo" to get it to only show that record?
Next
Reply
Map
View

Click here to load this message in the networking platform