J
Jason
Hey Guys:
I'm getting a "System.InvalidOperationException: Application-defined
or object defined error" message when I try to do any operations with
a SQLClient variable. I've used this on Pocket PC 2002 before
successfully, I don't know what's going on. Here's the code
snippet...very simple. And I have copied the System.Data.SqlClient and
other libraries out to the PDA. Very strange, any help is appreciated.
It throws the error on the cmd.ExecuteScalar line.
Thanks in advance.
-Jason
--------------------------------------------------------------
Private Sub HandleData2()
Dim SQL As String
Dim con As New SqlConnection("Password=xxxx;User
ID=xxx;Initial Catalog=xxx;Data Source=xxx")
Dim cmd As New SqlCommand
Dim location As String
Try
SQL = "SELECT PaperFileLocation FROM PaperFileLocations
WHERE PaperFileLocationID = 1025"
cmd.Connection = con
cmd.CommandText = SQL
location = cmd.ExecuteScalar()
MessageBox.Show(location)
Catch sqlErr As SqlException
MessageBox.Show("SQL Error: " & sqlErr.ToString)
Catch ioErr As InvalidOperationException
MessageBox.Show("IO Error: " & ioErr.ToString)
Catch otherErr As Exception
MessageBox.Show("Error: " & otherErr.ToString)
End Try
End Sub
---------------------------------------------------------------
I'm getting a "System.InvalidOperationException: Application-defined
or object defined error" message when I try to do any operations with
a SQLClient variable. I've used this on Pocket PC 2002 before
successfully, I don't know what's going on. Here's the code
snippet...very simple. And I have copied the System.Data.SqlClient and
other libraries out to the PDA. Very strange, any help is appreciated.
It throws the error on the cmd.ExecuteScalar line.
Thanks in advance.
-Jason
--------------------------------------------------------------
Private Sub HandleData2()
Dim SQL As String
Dim con As New SqlConnection("Password=xxxx;User
ID=xxx;Initial Catalog=xxx;Data Source=xxx")
Dim cmd As New SqlCommand
Dim location As String
Try
SQL = "SELECT PaperFileLocation FROM PaperFileLocations
WHERE PaperFileLocationID = 1025"
cmd.Connection = con
cmd.CommandText = SQL
location = cmd.ExecuteScalar()
MessageBox.Show(location)
Catch sqlErr As SqlException
MessageBox.Show("SQL Error: " & sqlErr.ToString)
Catch ioErr As InvalidOperationException
MessageBox.Show("IO Error: " & ioErr.ToString)
Catch otherErr As Exception
MessageBox.Show("Error: " & otherErr.ToString)
End Try
End Sub
---------------------------------------------------------------