Not sure what's wrong here. Any help would be appreciated. I am just hitting this sub after printing and want to mark it as printed in the Access Data Base.
This the Error I get: The ConnectionString property has not been initialized.
Thanks
This the Error I get: The ConnectionString property has not been initialized.
Thanks
Code:
Sub SaveData()
Dim con As New OleDb.OleDbConnection
Dim mycommand As OleDbCommand = New OleDb.OleDbCommand("SELECT Printed FROM tblWorkOrder WHERE WOClosed = False AND DeletedWO = False")
Dim SQLQuery = <sql> UPDATE tblWorkOrder SET Printed = TRUE </sql>
mycommand.Connection = con
mycommand.CommandText = SQLQuery.Value
mycommand.Connection = con
con.Open()
mycommand.Parameters.AddWithValue("@Printed", True)
Try
mycommand.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MessageBox.Show(ex.ToString)
con.Close()
End Try
End Sub