Actually, i try to execute some error and i received error which shows as below when i execute.
system.invalidoperationexception:ExecuteNonQuery:Connection property has not been initialized
Dim odbccon3 As OdbcConnection 'Declare the ODBC connection
Dim dr3 As OdbcDataReader
Dim cmd3 As New OdbcCommand
Dim ConnString3 As String = "Dsn=premierlc"
cmd3 = New OdbcCommand("SELECT * FROM XXXX ", odbccon3)
With cmd3
.CommandText = "insert into jobsheet values('" & "dsfsdf" & "','" & "dsfsdf" & "','" & "dsfsdf" & "','" & "dsfsdf" & "','" & "dsfsdf" & "','" & "dsfsdf" & "','" & "dsfsdf" & "','" & "dsfsdf" & "','" & "dsfsdf" & "','" & "dsfsdf" & "','" & "dsfsdf" & "','" & "dsfsdf" & "','" & "dsfsdf" & "','" & "dsfsdf" & "','" & "dsfsdf" & "','" & "dsfsdf" & "','" & "dsfsdf" & "')"
.CommandType = CommandType.Text
.Connection = odbccon3
End With
Dim z As Integer
Try
odbccon3 = New OdbcConnection(ConnString3)
odbccon3.Open() \\received error
z = cmd3.ExecuteNonQuery()
If z = 1 Then
'ToolStripStatusLabel1.Text = custname_cmb.Text & " data has been saved"
End If
Catch ex As Exception
MsgBox(ex.ToString())
End Try
Thanks in advance.