Strange error - help needed

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.
 
M

^MisterJingo^

Hi Jeff,

When i try that I get the following exception thrown:

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top