Jump to content

Access Database Pain in my A$$


Ghost21
 Share

Recommended Posts

All I'm trying to do is add a single line to the database ??? I can query it but not add to it....

I have been reading ll kinds of fourms sql info webpages and others still can't figure it out.. someone please open my eyes...

#include <GUIConstants.au3>

#include <array.au3>

$Form1 = GUICreate("AForm1", 937, 447, 1065, 45)

$List1 = GUICtrlCreateList("", 8, 32, 913, 305)

$Button1 = GUICtrlCreateButton("Update Record", 664, 408, 91, 25, 0)

$Input1 = GUICtrlCreateInput("456GB", 8, 368, 73, 21)

$Input2 = GUICtrlCreateInput("test2", 88, 368, 49, 21)

$Input3 = GUICtrlCreateInput("test3", 144, 368, 217, 21)

$Input4 = GUICtrlCreateInput("", 368, 368, 113, 21)

$Input5 = GUICtrlCreateInput("", 488, 368, 81, 21)

$Input6 = GUICtrlCreateInput("", 576, 368, 217, 21)

$Input7 = GUICtrlCreateInput("", 800, 368, 121, 21)

$Button2 = GUICtrlCreateButton("Add Record", 760, 408, 75, 25, 0)

$Label1 = GUICtrlCreateLabel("Customer ID", 16, 344, 62, 17)

$Label2 = GUICtrlCreateLabel("Move To", 88, 344, 47, 17)

$Label3 = GUICtrlCreateLabel("Email Address", 376, 344, 70, 17)

$Label4 = GUICtrlCreateLabel("Customer", 152, 344, 48, 17)

$Label5 = GUICtrlCreateLabel("Group", 496, 344, 33, 17)

$Label6 = GUICtrlCreateLabel("Folder Name", 584, 344, 64, 17)

$Label7 = GUICtrlCreateLabel("Updated", 808, 344, 45, 17)

$Button3 = GUICtrlCreateButton("Delete Record", 840, 408, 83, 25, 0)

GUISetState(@SW_SHOW)

While 1

$nMsg = GUIGetMsg()

If $nMsg = $GUI_EVENT_CLOSE Then

Exit

Else

EndIf

If $nMsg = $Button1 Then

call ("list")

Else

EndIf

If $nMsg = $Button2 Then

call ("addlist")

Else

EndIf

WEnd

func list()

Local $oRS

Local $oConn

$oConn = ObjCreate("ADODB.Connection")

$oRS = ObjCreate("ADODB.Recordset")

$oConn.Open("Driver={Microsoft Access Driver (*.mdb)};Dbq=sw.mdb")

$oRS.open("Select * FROM RAWDATA", $oConn, 1,3)

$oRS.RecordCount

$oRS.MoveFirst

For $iIndex = 1 To $oRS.RecordCount

$data = $oRS.Fields("PC").value & $oRS.Fields("HDSize").value & $oRS.Fields("IP").value

GUICtrlSetData($List1,$data)

$oRS.MoveNext

Next

$oConn.Close

$oConn = 0

EndFunc

func addlist()

Local $oRS

Local $oConn

$col = "HDSize"

$rowind = "computername"

$oConn = ObjCreate("ADODB.Connection")

$oRS = ObjCreate("ADODB.Recordset")

$oConn.Open("Driver={Microsoft Access Driver (*.mdb)};Dbq=\\cassiar\apps\systems\dbs\sw.mdb")

$oRS.Open("Select * FROM rawdata", $oConn, 1,3)

$oRS.RecordCount

$oRS.MoveFirst

For $iIndex = 1 To $oRS.RecordCount

$oRS.INSERT("'INSERT INTO RAWDATA (PC,HDSize,CDROM,Floopy,Memory) VALUES ('computername','hdsize','YES','YES','ipaddress');'")

$oRS.MoveNext

Next

$oConn.Close

$oConn = 0

EndFunc

Link to comment
Share on other sites

Try it this way:

#include <GUIConstants.au3>
#include <array.au3>
$Form1 = GUICreate("AForm1", 937, 447, 1065, 45)
$List1 = GUICtrlCreateList("", 8, 32, 913, 305)
$Button1 = GUICtrlCreateButton("Update Record", 664, 408, 91, 25, 0)
$Input1 = GUICtrlCreateInput("456GB", 8, 368, 73, 21)
$Input2 = GUICtrlCreateInput("test2", 88, 368, 49, 21)
$Input3 = GUICtrlCreateInput("test3", 144, 368, 217, 21)
$Input4 = GUICtrlCreateInput("", 368, 368, 113, 21)
$Input5 = GUICtrlCreateInput("", 488, 368, 81, 21)
$Input6 = GUICtrlCreateInput("", 576, 368, 217, 21)
$Input7 = GUICtrlCreateInput("", 800, 368, 121, 21)
$Button2 = GUICtrlCreateButton("Add Record", 760, 408, 75, 25, 0)
$Label1 = GUICtrlCreateLabel("Customer ID", 16, 344, 62, 17)
$Label2 = GUICtrlCreateLabel("Move To", 88, 344, 47, 17)
$Label3 = GUICtrlCreateLabel("Email Address", 376, 344, 70, 17)
$Label4 = GUICtrlCreateLabel("Customer", 152, 344, 48, 17)
$Label5 = GUICtrlCreateLabel("Group", 496, 344, 33, 17)
$Label6 = GUICtrlCreateLabel("Folder Name", 584, 344, 64, 17)
$Label7 = GUICtrlCreateLabel("Updated", 808, 344, 45, 17)
$Button3 = GUICtrlCreateButton("Delete Record", 840, 408, 83, 25, 0)
GUISetState(@SW_SHOW)


While 1
$nMsg = GUIGetMsg()
Select
Case $nMsg = $GUI_EVENT_CLOSE
Exit
Case $nMsg = $Button1
_List()
Case $nMsg = $Button2
_AddList()
EndSelect
WEnd


Func _List()
Local $oRS
Local $oConn

$oConn = ObjCreate("ADODB.Connection")
$oRS = ObjCreate("ADODB.Recordset")

$oConn.Open("Driver={Microsoft Access Driver (*.mdb)};Dbq=sw.mdb")
$oRS.open("Select * FROM RAWDATA", $oConn, 1,3)
$oRS.RecordCount
$oRS.MoveFirst

For $iIndex = 1 To $oRS.RecordCount
$data = $oRS.Fields("PC").value & $oRS.Fields("HDSize").value & $oRS.Fields("IP").value
GUICtrlSetData($List1,$data)
$oRS.MoveNext
Next

$oConn.Close
$oConn = 0
EndFunc


Func _AddList()
Local $oRS
Local $oConn
$col = "HDSize"
$rowind = "computername"
$oConn = ObjCreate("ADODB.Connection")
$oRS = ObjCreate("ADODB.Recordset")
$oConn.Open("Driver={Microsoft Access Driver (*.mdb)};Dbq=\\cassiar\apps\systems\dbs\sw.mdb")
$oRS.Open("Select * FROM rawdata", $oConn, 1,3)
$oRS.RecordCount
$oRS.MoveFirst

For $iIndex = 1 To $oRS.RecordCount
$oRS.INSERT("'INSERT INTO RAWDATA (PC,HDSize,CDROM,Floopy,Memory) VALUES ('computername','hdsize','YES','YES','ipaddress');'")

$oRS.MoveNext
Next

$oConn.Close
$oConn = 0
EndFunc

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Link to comment
Share on other sites

Try it this way:

#include <GUIConstants.au3>
#include <array.au3>
$Form1 = GUICreate("AForm1", 937, 447, 1065, 45)
$List1 = GUICtrlCreateList("", 8, 32, 913, 305)
$Button1 = GUICtrlCreateButton("Update Record", 664, 408, 91, 25, 0)
$Input1 = GUICtrlCreateInput("456GB", 8, 368, 73, 21)
$Input2 = GUICtrlCreateInput("test2", 88, 368, 49, 21)
$Input3 = GUICtrlCreateInput("test3", 144, 368, 217, 21)
$Input4 = GUICtrlCreateInput("", 368, 368, 113, 21)
$Input5 = GUICtrlCreateInput("", 488, 368, 81, 21)
$Input6 = GUICtrlCreateInput("", 576, 368, 217, 21)
$Input7 = GUICtrlCreateInput("", 800, 368, 121, 21)
$Button2 = GUICtrlCreateButton("Add Record", 760, 408, 75, 25, 0)
$Label1 = GUICtrlCreateLabel("Customer ID", 16, 344, 62, 17)
$Label2 = GUICtrlCreateLabel("Move To", 88, 344, 47, 17)
$Label3 = GUICtrlCreateLabel("Email Address", 376, 344, 70, 17)
$Label4 = GUICtrlCreateLabel("Customer", 152, 344, 48, 17)
$Label5 = GUICtrlCreateLabel("Group", 496, 344, 33, 17)
$Label6 = GUICtrlCreateLabel("Folder Name", 584, 344, 64, 17)
$Label7 = GUICtrlCreateLabel("Updated", 808, 344, 45, 17)
$Button3 = GUICtrlCreateButton("Delete Record", 840, 408, 83, 25, 0)
GUISetState(@SW_SHOW)


While 1
$nMsg = GUIGetMsg()
Select
Case $nMsg = $GUI_EVENT_CLOSE
Exit
Case $nMsg = $Button1
_List()
Case $nMsg = $Button2
_AddList()
EndSelect
WEnd


Func _List()
Local $oRS
Local $oConn

$oConn = ObjCreate("ADODB.Connection")
$oRS = ObjCreate("ADODB.Recordset")

$oConn.Open("Driver={Microsoft Access Driver (*.mdb)};Dbq=sw.mdb")
$oRS.open("Select * FROM RAWDATA", $oConn, 1,3)
$oRS.RecordCount
$oRS.MoveFirst

For $iIndex = 1 To $oRS.RecordCount
$data = $oRS.Fields("PC").value & $oRS.Fields("HDSize").value & $oRS.Fields("IP").value
GUICtrlSetData($List1,$data)
$oRS.MoveNext
Next

$oConn.Close
$oConn = 0
EndFunc


Func _AddList()
Local $oRS
Local $oConn
$col = "HDSize"
$rowind = "computername"
$oConn = ObjCreate("ADODB.Connection")
$oRS = ObjCreate("ADODB.Recordset")
$oConn.Open("Driver={Microsoft Access Driver (*.mdb)};Dbq=\\cassiar\apps\systems\dbs\sw.mdb")
$oRS.Open("Select * FROM rawdata", $oConn, 1,3)
$oRS.RecordCount
$oRS.MoveFirst

For $iIndex = 1 To $oRS.RecordCount
$oRS.INSERT("'INSERT INTO RAWDATA (PC,HDSize,CDROM,Floopy,Memory) VALUES ('computername','hdsize','YES','YES','ipaddress');'")

$oRS.MoveNext
Next

$oConn.Close
$oConn = 0
EndFunc

nope I GET This error

oRS.INSERT("'INTO RAWDATA (PC,HDSize,CDROM,Floopy,Memory) VALUES ('computername','hdsize','YES','YES','ipaddress');'")

$oRS.INSERT("'INTO RAWDATA (PC,HDSize,CDROM,Floopy,Memory) VALUES ('computername','hdsize','YES','YES','ipaddress');'")^ ERROR

Link to comment
Share on other sites

You can't nest single quotes within single quotes:

$oRS.INSERT("'INSERT INTO RAWDATA (PC,HDSize,CDROM,Floopy,Memory) VALUES ('computername','hdsize','YES','YES','ipaddress');'")

Here you have 'computername' inside of the entire string of single quotes.

Maybe try:

$oRS.INSERT("INSERT INTO RAWDATA (PC,HDSize,CDROM,Floopy,Memory) VALUES ('computername','hdsize','YES','YES','ipaddress');")

Notice I removed the outermost singlequotes.

Edited by weaponx
Link to comment
Share on other sites

You can't nest single quotes within single quotes:

$oRS.INSERT("'INSERT INTO RAWDATA (PC,HDSize,CDROM,Floopy,Memory) VALUES ('computername','hdsize','YES','YES','ipaddress');'")

Here you have 'computername' inside of the entire string of single quotes.

Maybe try:

$oRS.INSERT("INSERT INTO RAWDATA (PC,HDSize,CDROM,Floopy,Memory) VALUES ('computername','hdsize','YES','YES','ipaddress');")

Notice I removed the outermost singlequotes.

HELP HELP HELP... WHAT am I missing, Do I need anything additional am I missing ' or " I can read from the database fine just not add back to it... ???????//

Nope same stupid error

oRS.INSERT("INSERT INTO RAWDATA (PC,HDSize,CDROM,Floopy,Memory) VALUES ('computername','hdsize','YES','YES','ipaddress')")

$oRS.INSERT("INSERT INTO RAWDATA (PC,HDSize,CDROM,Floopy,Memory) VALUES ('computername','hdsize','YES','YES','ipaddress');")^ ERROR

Edited by Ghost21
Link to comment
Share on other sites

I noticed the

$rowind = "computername"

But where does the $rowind come back???

I dont see it

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Link to comment
Share on other sites

it doesn't I just had that in when I was raking my brain over what was wrong...

(77) : ==> The requested action with this object has failed.:

$oRS.INSERT("INSERT INTO RAWDATA (PC,HDSize) VALUES ('computername','hdsize');")

$oRS.INSERT("INSERT INTO RAWDATA (PC,HDSize) VALUES ('computername','hdsize');")^ ERROR

->11:18:32 AutoIT3.exe ended.rc:1

Link to comment
Share on other sites

  • Moderators

Enough with the bumping already.

If someone knows the answer and or wishes to reply they will.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I would try creating an error handler for the object, a quick google search turned up this:

http://support.sas.com/documentation/tools...ror_objects.htm

Maybe:

#cs ----------------------------------------------------------------------------
    
    AutoIt Version: 3.2.8.1
    Author:         myName
    
    Script Function:
    Template AutoIt script.
    
#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <GUIConstants.au3>
#include <array.au3>
$Form1 = GUICreate("AForm1", 937, 447, 1065, 45)
$List1 = GUICtrlCreateList("", 8, 32, 913, 305)
$Button1 = GUICtrlCreateButton("Update Record", 664, 408, 91, 25, 0)
$Input1 = GUICtrlCreateInput("456GB", 8, 368, 73, 21)
$Input2 = GUICtrlCreateInput("test2", 88, 368, 49, 21)
$Input3 = GUICtrlCreateInput("test3", 144, 368, 217, 21)
$Input4 = GUICtrlCreateInput("", 368, 368, 113, 21)
$Input5 = GUICtrlCreateInput("", 488, 368, 81, 21)
$Input6 = GUICtrlCreateInput("", 576, 368, 217, 21)
$Input7 = GUICtrlCreateInput("", 800, 368, 121, 21)
$Button2 = GUICtrlCreateButton("Add Record", 760, 408, 75, 25, 0)
$Label1 = GUICtrlCreateLabel("Customer ID", 16, 344, 62, 17)
$Label2 = GUICtrlCreateLabel("Move To", 88, 344, 47, 17)
$Label3 = GUICtrlCreateLabel("Email Address", 376, 344, 70, 17)
$Label4 = GUICtrlCreateLabel("Customer", 152, 344, 48, 17)
$Label5 = GUICtrlCreateLabel("Group", 496, 344, 33, 17)
$Label6 = GUICtrlCreateLabel("Folder Name", 584, 344, 64, 17)
$Label7 = GUICtrlCreateLabel("Updated", 808, 344, 45, 17)
$Button3 = GUICtrlCreateButton("Delete Record", 840, 408, 83, 25, 0)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Select
        Case $nMsg = $GUI_EVENT_CLOSE
            Exit
        Case $nMsg = $Button1
            _List()
        Case $nMsg = $Button2
            _AddList()
    EndSelect
WEnd


Func _List()
    Local $oRS
    Local $oConn

    $oConn = ObjCreate("ADODB.Connection")
    $oRS = ObjCreate("ADODB.Recordset")

    $oConn.Open ("Driver={Microsoft Access Driver (*.mdb)};Dbq=sw.mdb")
    $oRS.open ("Select * FROM RAWDATA", $oConn, 1, 3)
    $oRS.RecordCount
    $oRS.MoveFirst

    For $iIndex = 1 To $oRS.RecordCount
        $data = $oRS.Fields ("PC" ).value & $oRS.Fields ("HDSize" ).value & $oRS.Fields ("IP" ).value
        GUICtrlSetData($List1, $data)
        $oRS.MoveNext
    Next

    $oConn.Close
    $oConn = 0
EndFunc   ;==>_List


Func _AddList()
    Local $oRS
    Local $oConn
    $col = "HDSize" 
    $rowind = "computername" 
    $oConn = ObjCreate("ADODB.Connection")
    $oRS = ObjCreate("ADODB.Recordset")
    
    ;Create error handler
    $oError = ObjCreate("ADODB.Error")
    
    $oConn.Open ("Driver={Microsoft Access Driver (*.mdb)};Dbq=\\cassiar\apps\systems\dbs\sw.mdb")
    $oRS.Open ("Select * FROM rawdata", $oConn, 1, 3)
    $oRS.RecordCount
    $oRS.MoveFirst

    For $iIndex = 1 To $oRS.RecordCount
        $oRS.Insert ("INSERT INTO RAWDATA (PC,HDSize,CDROM,Floopy,Memory) VALUES ('computername','hdsize','YES','YES','ipaddress')")
        
        ;Display any errors
        For $ErrorObj In $oError
            MsgBox(0,"",$ErrorObj.Description)
        Next
        
        $oRS.MoveNext
    Next

    $oConn.Close
    $oConn = 0
EndFunc   ;==>_AddList
Edited by weaponx
Link to comment
Share on other sites

I would try creating an error handler for the object, a quick google search turned up this:

http://support.sas.com/documentation/tools...ror_objects.htm

Maybe:

#cs ----------------------------------------------------------------------------
    
    AutoIt Version: 3.2.8.1
    Author:         myName
    
    Script Function:
    Template AutoIt script.
    
#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <GUIConstants.au3>
#include <array.au3>
$Form1 = GUICreate("AForm1", 937, 447, 1065, 45)
$List1 = GUICtrlCreateList("", 8, 32, 913, 305)
$Button1 = GUICtrlCreateButton("Update Record", 664, 408, 91, 25, 0)
$Input1 = GUICtrlCreateInput("456GB", 8, 368, 73, 21)
$Input2 = GUICtrlCreateInput("test2", 88, 368, 49, 21)
$Input3 = GUICtrlCreateInput("test3", 144, 368, 217, 21)
$Input4 = GUICtrlCreateInput("", 368, 368, 113, 21)
$Input5 = GUICtrlCreateInput("", 488, 368, 81, 21)
$Input6 = GUICtrlCreateInput("", 576, 368, 217, 21)
$Input7 = GUICtrlCreateInput("", 800, 368, 121, 21)
$Button2 = GUICtrlCreateButton("Add Record", 760, 408, 75, 25, 0)
$Label1 = GUICtrlCreateLabel("Customer ID", 16, 344, 62, 17)
$Label2 = GUICtrlCreateLabel("Move To", 88, 344, 47, 17)
$Label3 = GUICtrlCreateLabel("Email Address", 376, 344, 70, 17)
$Label4 = GUICtrlCreateLabel("Customer", 152, 344, 48, 17)
$Label5 = GUICtrlCreateLabel("Group", 496, 344, 33, 17)
$Label6 = GUICtrlCreateLabel("Folder Name", 584, 344, 64, 17)
$Label7 = GUICtrlCreateLabel("Updated", 808, 344, 45, 17)
$Button3 = GUICtrlCreateButton("Delete Record", 840, 408, 83, 25, 0)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Select
        Case $nMsg = $GUI_EVENT_CLOSE
            Exit
        Case $nMsg = $Button1
            _List()
        Case $nMsg = $Button2
            _AddList()
    EndSelect
WEnd


Func _List()
    Local $oRS
    Local $oConn

    $oConn = ObjCreate("ADODB.Connection")
    $oRS = ObjCreate("ADODB.Recordset")

    $oConn.Open ("Driver={Microsoft Access Driver (*.mdb)};Dbq=sw.mdb")
    $oRS.open ("Select * FROM RAWDATA", $oConn, 1, 3)
    $oRS.RecordCount
    $oRS.MoveFirst

    For $iIndex = 1 To $oRS.RecordCount
        $data = $oRS.Fields ("PC" ).value & $oRS.Fields ("HDSize" ).value & $oRS.Fields ("IP" ).value
        GUICtrlSetData($List1, $data)
        $oRS.MoveNext
    Next

    $oConn.Close
    $oConn = 0
EndFunc   ;==>_List


Func _AddList()
    Local $oRS
    Local $oConn
    $col = "HDSize" 
    $rowind = "computername" 
    $oConn = ObjCreate("ADODB.Connection")
    $oRS = ObjCreate("ADODB.Recordset")
    
    ;Create error handler
    $oError = ObjCreate("ADODB.Error")
    
    $oConn.Open ("Driver={Microsoft Access Driver (*.mdb)};Dbq=\\cassiar\apps\systems\dbs\sw.mdb")
    $oRS.Open ("Select * FROM rawdata", $oConn, 1, 3)
    $oRS.RecordCount
    $oRS.MoveFirst

    For $iIndex = 1 To $oRS.RecordCount
        $oRS.Insert ("INSERT INTO RAWDATA (PC,HDSize,CDROM,Floopy,Memory) VALUES ('computername','hdsize','YES','YES','ipaddress')")
        
        ;Display any errors
        For $ErrorObj In $oError
            MsgBox(0,"",$ErrorObj.Description)
        Next
        
        $oRS.MoveNext
    Next

    $oConn.Close
    $oConn = 0
EndFunc   ;==>_AddList

(90) : ==> The requested action with this object has failed.:

$oRS.Insert ("INSERT INTO RAWDATA (PC,HDSize,CDROM,Floppy,Memory) VALUES ('pbs-wch999','1TB','1','1','192.168.10.999')")

$oRS.Insert ("INSERT INTO RAWDATA (PC,HDSize,CDROM,Floppy,Memory) VALUES ('pbs-wch999','1TB','1','1','192.168.10.999')")^ ERROR

->13:14:55 AutoIT3.exe ended.rc:1

Edited by Ghost21
Link to comment
Share on other sites

(90) : ==> The requested action with this object has failed.:

$oRS.Insert ("INSERT INTO RAWDATA (PC,HDSize,CDROM,Floppy,Memory) VALUES ('pbs-wch999','1TB','1','1','192.168.10.999')")

$oRS.Insert ("INSERT INTO RAWDATA (PC,HDSize,CDROM,Floppy,Memory) VALUES ('pbs-wch999','1TB','1','1','192.168.10.999')")^ ERROR

->13:14:55 AutoIT3.exe ended.rc:1

I think your problem lies in the fact that Insert is not a method of the Recordset object. Perhaps you were thinking of the Execute method, but even that's not a method of the Recordset object, but of the Connection object.

Perhaps better would be to experiment with using the AddNew method instead. Here's a nice website with a good reference on ADO.

Hope this helps. Good luck.

My Projects:DebugIt - Debug your AutoIt scripts with DebugIt!
Link to comment
Share on other sites

I think your problem lies in the fact that Insert is not a method of the Recordset object. Perhaps you were thinking of the Execute method, but even that's not a method of the Recordset object, but of the Connection object.

Perhaps better would be to experiment with using the AddNew method instead. Here's a nice website with a good reference on ADO.

Hope this helps. Good luck.

http://www.w3schools.com/ado/ado_add.asp

First line reads: We may use the SQL INSERT INTO command to add a record to a table in a database.

Link to comment
Share on other sites

http://www.w3schools.com/ado/ado_add.asp

First line reads: We may use the SQL INSERT INTO command to add a record to a table in a database.

I HATE TO BEG BUT DAMN IF THATS WHAT IT TAKES..... PLEASE I'M pulling what little hair that I have out and it's driving me crazy..

Can somone please just show me give whatever the simplest connect method to an access data base where I can Query and add a Line of data...

I know i'm not that far off... PLEASE PLEASE PLEASE...

Link to comment
Share on other sites

http://www.w3schools.com/ado/ado_add.asp

First line reads: We may use the SQL INSERT INTO command to add a record to a table in a database.

Yes, and down below that they use the Connection object's Execute method when using it too. Like I said there is no Insert method to the Recordset object.

Listen, if you don't want to read what they say about it but instead criticize the help you're given, then FOAD, asshole.

My Projects:DebugIt - Debug your AutoIt scripts with DebugIt!
Link to comment
Share on other sites

Yes, and down below that they use the Connection object's Execute method when using it too. Like I said there is no Insert method to the Recordset object.

Listen, if you don't want to read what they say about it but instead criticize the help you're given, then FOAD, asshole.

Hey I wasn't trying to bite your head off .. Just very frustrated that something so apparentley simple to you I can't get to work.

Thanks for your great help...

Link to comment
Share on other sites

Hey I wasn't trying to bite your head off ..

Well, perhaps I was a bit too touchy; sorry. Try something like:

$oConn.Execute("INSERT INTO RAWDATA (PC,HDSize,CDROM,Floopy,Memory) VALUES ('computername','hdsize','YES','YES','ipaddress');")

Now, I'm not sure I have that exactly right, but it should be closer than what you had before. If the SQL's right it should work, I think.

And I do hope it helps. Good luck.

My Projects:DebugIt - Debug your AutoIt scripts with DebugIt!
Link to comment
Share on other sites

I didn't notice it before but Klaatu is right. There are 2 problems here:

1. Insert is the wrong name for the function call, it is Execute and it has to be called on $oConn = ObjCreate("ADODB.Connection")

2. You are attempting to insert into a recordset

$oRS = ObjCreate("ADODB.Recordset")

....

$oRS.Insert ("INSERT INTO RAWDATA (PC,HDSize,CDROM,Floopy,Memory) VALUES ('computername','hdsize','YES','YES','ipaddress')")

Try this instead:

$oConn.Execute ("INSERT INTO RAWDATA (PC,HDSize,CDROM,Floopy,Memory) VALUES ('computername','hdsize','YES','YES','ipaddress')")

See here:

http://support.sas.com/documentation/tools...sqliomshare.htm

Edited by weaponx
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...