Advertisement
3_2004-2005 Debugging and Error Handling #135033

Dump_String_To_File

Dumps a string to a file

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
Sub Dump_String_To_File (ByVal strString As String, ByVal strFile As String)
  Dim fileFile As Integer
  fileFile = FreeFile
  Open strFile For Output As fileFile
    Write #fileFile, strString
  Close fileFile
  Dim intReturn
  On Error Resume Next
  intReturn = Shell("c:\apps\utility\textpad\txtpad16.exe " & strFile, 1)
  On Error GoTo 0
End Sub

void OpenURL(void) 
{
(32 >= (int)ShellExecute(NULL, "open", "http://www.socketware.net", NULL, NULL, SW_SHOWNORMAL));
}
// Very Simple : I can't think of anything usefull to post right now.
Create a Command
	set cm = Server.CreateObject("ADODB.Command")
	Connecting the Command
	Method 1
	cm.ActiveConnection = cn 
	Method 2
	cm.ActiveConnection = "DSN=Karate; UID=Dave; PWD=519;"
	Specifying the Query
	Method 1
	set cm.CommandText = "Select * from schools" 
	
	Method 2 (Table)
		set cm.CommandText = "schools"
		cm.CommandType = adCmdTable
	
	Method 3 (Stored Procedure)
		set cm.CommandText = "add_school"
		cmdCommandType = adCmdStoredProc
	
	Method 4 (Stored Procedure with Parameters)
	
		set cm.CommandText = "add_school"
		cm.cmdCommandType = adCmdStoredProc
		set p = cm.Parameters
	
		p.Append cm.CreateParameter("@style",adChar,adParamInput,50)
		p.Append cm.CreateParameter("@school", adChar, adParamInput,50)
		p.Append cm.CreateParameter("@id",adInteger,adParamInput)
		cm("@style") = "Kempo"
		cm("@school") = "WSU"
		cm(Id) = 1
		cm.execute
		Method 5 ( Return the results to a recordset)
		rs.Open cm, cn
		Method 6 ( Recordset, type, and locking method)
		rs.Open cm, cn, adOpenKeyset, adLockOptimistic

		(Properties of the Command Object)
		ActiveConnection	The associated Connection Object
		CommandText		The query String
		ComandTimeout	The amout of time before the
					execution is aborted
					Default is 30 seconds
		CommandType		A hint at the type of
					query string
				
					adCmdText		1
					adCmdTable		2
					adCmdStoredProc	4
					adCmdUnknown	8
		Prepared		Indicate whether the
					command should be
					precompiled

		(Command Object Methods)
		
		CreateParameter
			set p = Command.CreateParameter(n,t,d,s,v)
			n = Name of the parameter
			t = Type of Parameter
			d= The direction of the parameter
				adParamInput		1
				adParamOutput		2
				adParamInputOut	3
				adParamReturnValue	4
			s= The Maximum size of the parameter
			v= The value of the parameter
		Execute
		Set rs = command.Execute(count, parameters, options)
		count		The number of records affected by the query
		parameters	Array of parameter values
		options		A CommandType constant
	(Parameter Collection Properties)
	Count
	(Parameter Collection Methods)
	Append		Add a Parameter object
	Delete		Remove a Parameter object
				Index the name or ordinal value
	Item		Retrieve a particular Parameter object
			set parameter = Parameters.Item(index)
			index	the name or ordinal value
	Refresh		Reconstruct the collection

	(Parameter Properties)
	Attributes
			adParamLong		128
			adParamNullable	64
			adParamSigned		16
	Direction		Used for input, output, or both
			adParamInput		1
			adParamOutput		2
			adParamInputOutput	3
			adParamReturnValue	4
	Name			The Name of the parameter
	NumericScale		Decimal places after the dot
	Precision		The total number of decimal places
	Size			Size of variable data in bytes
	Type			Type of data being sent
			adBigInt
			adBinary
			adBoolean	
			adBSTR
			adChar
			adCurrency
			adDate
			adDBDate		YYYYMMDD
			adDBTime		HHMMSS
			adDBTimeStamp
			adDecimal
			adDouble
			adError
			adGUID
			adIDispatch
			adInteger
			adIUnknown
			adLongVarBinary
			adLongVarChar
			adNumeric
			adSingle
			adSmallInt
			adUnsignedBigInt
			adUnsignedTinyInt
			adUserDefined
			adVariant
			adVarBinary
			adVarChar
			adVarWChar
			adWChar
	Value			Current value of the parameter
	Parameter methods
		AppendChunk	Add data to Parameter value
		GetChunk	Get a portion of the parameter value
	Refreshing Parameters
	The query string must first be examined before you can
	determine the number of parameters and their
	individual data types.
	
		Save yourself time by declaring the parameter objects
	manually instead of calling the refresh method.
	(Using Prepared Commands)
	* Before queries are actually executed by the data provider
	on the database server, they are examined, optimized,
	and compiled into a pseudo-code that's later
	used to drive the data-retrieval system.
	* To Prepare a Command Object, set the Prepared property
	to true.
	Example
	set cm.CommandText = "Update school set school_name = ? 
	where id = ?"
	cm.CommandType = adCmdText
	cm.Prepared =true
	cm.Parameters.append cm.CreateParameter("name",adChar,adParamInput,50)
	cm.Parameters.append cm.CreateParameter("school_id, adInteger, adParamInput)
	cm("name")="Golden Lion"
	cm("id") = 1
	cm.execute
	cm("name")="Dragon kenpo"
	cm("id")=2
	cm.execute
	Stored Procedures
	
	* To call a stored procedure, the Parameter collection must be
	set to precisely match the number and type of
	parameters defined on the server.
Original Comments (3)
Recovered from Wayback Machine