Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27034

VS 2008 [RESOLVED] The ConnectionString property has not been initialized. Not sure whats Wrong

$
0
0
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



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


Viewing all articles
Browse latest Browse all 27034

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>