Strange error - help needed

  • Thread starter Thread starter ^MisterJingo^
  • Start date Start date
M

^MisterJingo^

I am getting the following error:

Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Specified cast is not
valid.


Line 60: Dim myCommand As New MySqlCommand(myInsertQuery)
Line 61: myCommand.Connection = myConnection
Line 62: myConnection.Open()
Line 63: myCommand.ExecuteNonQuery()
Line 64: myCommand.Connection.Close()


from this code:

Dim myConnectionString As String
="SERVER=localhost;DATABASE=evaluation;UID=<username>;PASSWORD=<password>;"

Dim myConnection As New MySqlConnection(myConnectionString)
Dim myInsertQuery As String = "insert into tbl_ssa (ipAddress) values
('127.188.01.01')"
Dim myCommand As New MySqlCommand(myInsertQuery)
myCommand.Connection = myConnection
myConnection.Open()
myCommand.ExecuteNonQuery()
myCommand.Connection.Close()

I have no idea why this is happening. The database and table exist, I
can connect with other projects.

Any help in sorting this out would be greatly appreciated.
 
Hi Jeff,

When i try that I get the following exception thrown:

Exception Details: System.Net.Sockets.SocketException: No such host is
known
 
Back
Top