I'm new to KiXtart so please don't destroy my code at my first attempt at writing a script. All I want to do is write a simple entry to a database and this is what I've tried:
Code:
$DBServer = "localhost"
$DBName = "test"
$DBUser = ""
$DBPassword = ""
$cnDriver = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=$DBServer;DATABASE=$DBName;USER=$DBUser;PASSWORD=$DBPassword;OPTION=3;"
$sql = "SELECT * FROM test"
$cn = CreateObject ("ADODB.Connection")
$cmd = CreateObject ("ADODB.Command")
$rs = CreateObject ("ADODB.Recordset")
$cn.ConnectionString = $cnDriver
$cn.Open
$cmd.ActiveConnection = $cn
$rs.CursorType = 3
$rs.LockType = 3
$rs.ActiveCommand = $cmd
$cmd.CommandText = $sql
$rs.Open ($cmd)
If $rs.EOF = -1
$rs.AddNew
EndIf
$rs.Fields.Item("name").Value = "test"
$rs.Update
$rs.Close
$cn.Close
It runs without errors but it doesn't write anything to my DB
Edited by thepip3r (2005-04-06 08:00 PM)