Hello, codegurus. Excuse me, but I need help.

I have been assigned to deploy a system that uses VB.Net and MySQL. After testing on 9 different PCs each on different regions, only 1 PC shows this error during deployment:

System.ArgumentException: Formatof the initialization string does not conform to specification starting at index 22.
at System.Data.Common.DBConnectionString.GetKeyValuePair(Char[] connectionSting,Int32 currentPosition, String& key, Char[] valuebuf, Int32&vallength, Boolean&isempty)
at System.Data.Common.DBConnectionString.ParseInternal(Char[] connectionString, UdlSupport checkForUdl, NameValuePair & keychain)
at System.Data.Common.DBConnectionString..ctor(String ConnectionString ,UdlSupport check for Udl)
at System.Data.Common.DBConnectionString.ParseString(StringconnectionString)
at System.Data.Odbc.OdbcConnection.set_ConnectionString(String value)
at ProjectMembershipCounter.Module1.SyncTime()

What does that error means and what did I do wrong?

Public Function SyncTime()
        Dim strSQL As String
        Dim drdate As OdbcDataReader
        Dim drtime As OdbcDataReader
        Dim conn As New OdbcConnection
        Dim curdate As Date

        Try
            strSQL = "SELECT NOW()"

            conn.ConnectionString = "Driver={MySQL ODBC 3.51 Driver}" & _
                                    ";SERVER=" & g_OUTLETSERVER & _
                                    ";PORT=" & g_DBPORT & _
                                    ";UID=" & g_DBUser & _
                                    ";PWD=" & g_DBPwd & _
                                    ";allow zero datetime=no"
            conn.Open()
            Dim rCmd As New OdbcCommand(strSQL, conn)
            drdate = rCmd.ExecuteReader()

            If drdate.Read Then
                curdate = CType(drdate.Item("now()"), Date)
            End If

            Dim st As SYSTEMTIME
            st.year = curdate.Year
            st.month = curdate.Month
            st.dayOfWeek = curdate.DayOfWeek
            st.day = curdate.Day
            st.hour = curdate.Hour
            st.minute = curdate.Minute
            st.second = curdate.Second
            st.milliseconds = curdate.Millisecond

            'Set the new time...
            SetLocalTime(st)

            conn.Close()
        Catch ex As Exception
            MsgBox(ex.ToString)
            conn.Close()
        End Try
    End Function

using ODBC connector v3.51.27 and MySQL essential-4.1.13a-win3

Help is needed and appreciated...thanks in advance.

Hi!

Is this line causing error ????
curdate = CType(drdate.Item("now()"), Date)

The first code block you attached is the stack trace, which helps to get information about the error occurring in our program.

Hi, sorry for the late reply.

If that line causes error, it should cause the same error to all of the other 12 machines (yes, the whole number of client pc to deploy is 13, 9 is up to the last one i installed previously), but no, it doesn't.

On other forum, vbdotnet, i posted the same problem, and one member pointed out that maybe the connection string is not valid on that client pc. Strangely, it doesn't happen all the time- it happens only almost 50% of the time. My team leader checked and thought maybe it's the connection problem between the client's pc and the server in their region, but up to this day i still havent confirmed the true reason of the issue.

I dont know if this problem should be tagged solved or just be left as it is.

This article has been dead for over six months. Start a new discussion instead.