Write to db
 Code:
		$cn = CreateObject("ADODB.Connection")	$cmd= CreateObject("ADODB.Command")	$rs = CreateObject("ADODB.RecordSet")
		$cn.connectionstring = "DRIVER={SQL Server};SERVER=sqlserver;UID=username;PWD=password;DATABASE=dbname"
		$cn.open
			$cmd.activeconnection = $cn
			$rs.cursortype = 3
			$rs.locktype = 3
			$rs.activecommand = $cmd
			$cmdtxt = "select * from dbo._tbl_Main where SerialNumber = '$serNo'"
			$cmd.commandtext = $cmdtxt
			$rs.open ($cmd)				;? 'Error = '+@ERROR+' - '+@SERROR
				IF $rs.eof = -1		$rs.addnew	ENDIF 
				$rs.fields.item("UserName").value      = @userid
				$rs.update			;? 'Error = '+@ERROR+' - '+@SERROR
			$rs.close
		$cn.close
_________________________
How to ask questions the smart way <-----------> Before you ask