rookie
|
Posted: 03/31/2004, 5:24 PM |
|
Hi, how can I create a form to save in a .txt file?
I already have the code to save in the .txt file, but:
1. it seems like CCS dont let me built a form with out "connecting" it to a
DataBase.
2. How can I "call" a field in that for, i've used Country and {Country} but
it doesnt work.
|
|
|
ryan
Posts: 41
|
Posted: 03/31/2004, 6:55 PM |
|
You must use DBConnection1 if Connection1 is the name of your database then add a function inside common.asp so that you can access all CCS functions, routines, etc. For example I use this function to create a csv file and use that on other interfaces.
Function AccessInventory()
Const ForWriting = 2
Const Create = True
Dim PickedUpBy
Dim FSO ' FileSystemObject
Dim TS,TSO ' TextStreamObject
Dim InventoryFile, CS_OrderedItem, RS, SQL, FldHeading, PriceLimit
InventoryFile = Request.ServerVariables("APPL_PHYSICAL_PATH") & remotehome () & "CanteenSales\csv\Inventory_"&session("InventoryFile")&".csv"
SQL = "select " & _
"empID, " & _
"Item_Code, " & _
"Price As Amount, " & _
"Amount as NoOfPcs, " & _
"Year(DateOrdered) as TransactYear, " & _
"GeneratedDateTime as TransactDateTime, " & _
"PickedUpBy " & _
"from cs_ordereditem " & _
"where (empID not in ('admin','1234','5678')) " & _
"order by ProductDescr "
FldHeading = """WeekNo"",""EmpID"",""ItemCode"",""ItemDescription"",""PriceType"",""PriceLimit"",""OrigPrice"",""NoOfPcs"",""Amount"",""TransactYear"",""TransactDateTime"",""PickedUpBy"",""MaxBaratilloAllowed""" & Break_ ()
session("CS_OrderedItem") = ""
SET RS = DBConnection1.Execute(SQL)
IF NOT RS.EOF THEN
DO
SELECT CASE GetPriceType (RS("Item_Code"))
CASE "b","B"
PriceLimit = CCDLookup("AttValue","CS_CSVPrize","Attribute='B'",DBConnection1)
CASE ELSE
PriceLimit = CCDLookup("AttValue","CS_CSVPrize","Attribute='R'",DBConnection1)
END SELECT
PickedUpBy = RS("PickedUpBy")
IF (PickedUpBy="" OR IsNull(PickedUpBy) OR IsEmpty(PickedUpBy)) THEN PickedUpBy=RS("empID")
session("CS_OrderedItem") = session("CS_OrderedItem") & _
uquotes(CurrentWeek) & "," & _
uquotes(RS("empID")) & "," & _
uquotes(RS("Item_Code")) & "," & _
uquotes(GetItemDescription (RS("Item_Code"))) & "," & _
uquotes(GetPriceType (RS("Item_Code"))) & "," & _
uquotes(IfNumericDouble(PriceLimit)+(IfNumericDouble(PriceLimit)*.05)) & "," & _
uquotes(GetPrice (RS("Item_Code"))) & "," & _
uquotes(RS("NoOfPcs")) & "," & _
uquotes(RS("Amount")) & "," & _
uquotes(RS("TransactYear")) & "," & _
uquotes(RS("TransactDateTime")) & "," & _
uquotes(PickedUpBy) & "," & _
uquotes(GetMaxBaratilloAllowed (RS("Item_Code"))) & Break_ ()
RS.MoveNext
LOOP UNTIL RS.EOF
END IF
RS.Close : SET RS = Nothing
SQL = "UPDATE CS_Dummy " & _
"SET AccessInventory = " & CCToSQL ("Inventory_"&session("InventoryFile")&".csv","Text") & _
"WHERE (DummyField='IT') "
DBConnection1.Execute(SQL)
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
'Response.Write InventoryFile : Response.End
Set TS = FSO.OpenTextFile(InventoryFile, ForWriting, Create)
'TS.Write FldHeading & session("CS_OrderedItem")
TS.Write session("CS_OrderedItem")
'Response.Write (FldHeading & session("CS_OrderedItem")) : Response.End
TS.close
Set TS = Nothing
Set FSO = Nothing
'remember to uncomment
'SQL = EmployeeMasterCSV ()
End Function
_________________
(\__/)
(='.'=)
(")_(") |
|
|
|