|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Strange error - help neededDescription: 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. What exact line is the error happening?
Jeff Show quoteHide quote "^MisterJingo^" <misterji***@gmail.com> wrote in message news:1146148336.125340.210470@e56g2000cwe.googlegroups.com... >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. > Jeff Dillon wrote:
> What exact line is the error happening? It's happening on this line:> Hi Jeff, myConnection.Open() Not sure about your connection string. Usually it's (local) and not
localhost. http://www.connectionstrings.com Show quoteHide quote "^MisterJingo^" <misterji***@gmail.com> wrote in message news:1146162228.026617.52300@i40g2000cwc.googlegroups.com... > Jeff Dillon wrote: >> What exact line is the error happening? >> > Hi Jeff, > > It's happening on this line: > > myConnection.Open() > Hi Jeff,
When i try that I get the following exception thrown: Exception Details: System.Net.Sockets.SocketException: No such host is known
VB (5or6) does something wierd with image data
how to fill listview without image How to detect removeable drive insertion Salamander Online Decompiler v2 available Inserting HTML into a page based on conditions Mabry FTP/NET LicenseKey ! What happened with module variables? Save RTF to SQL Server 2000 Handling Data grid Spliting in VB.Net VS 2003 projects converted to VS2005 problem with "Strong name validation failed" during debugging |
|||||||||||||||||||||||