I am trying to connect to a Microsoft SQL database and update any record that the = field has changed to 'x'. I can query the database, but when I try to upgrade, I get this error.
Fill: An exception that throws a "Fill" with the argument "1": "Timed out." The timeout period before the operation is completed, or the server is not responding. "
$con = new-object "System.data.sqlclient.SQLconnection"
$con.ConnectionString =("Data Source=server;Initial Catalog=IDCards;Integrated Security=SSPI")
$con.open()
$sqlcmd = new-object "System.data.sqlclient.sqlcommand"
$sqlcmd.connection = $con
$sqlcmd.CommandTimeout = 600000
$sqlcmd.CommandText = "UPDATE dbo.tblPhotoID SET Changed = '1' WHERE Changed ='X'"
$adapter = New-Object system.data.sqlclient.sqldataadapter ($sqlcmd.CommandText, $con)
$set = New-Object system.data.dataset
$adapter.Fill($set)
Currently updated about 4,000 entries. The script runs about 30 seconds before the timeout. I tried to increase the team timeout and got the same results.
source
share