Send a suggestion!

We're building a brand new version of the site, and we'd love to hear your ideas

Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

General Exception occurs

Last post 05-06-2008 6:59 AM by ripanbiswas. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-02-2008 1:08 PM

    • shikha_21
    • Not Ranked
    • Joined on 05-01-2008
    • India
    • New Member
    • Points 100

    General Exception occurs

    pls someone help me in my coding general exception occurs each time.

    Exception is :Format of the initialization string does not conform to specification starting at index 0.

    What does it means???

    <vb> 

       Private Sub cmdok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdok.Click

            If txtnew.Text = "" Or txtconform.Text = "" Or txtold.Text = "" Then
                MsgBox("Fill data into every field", MsgBoxStyle.Exclamation, "Null data Field")
            End If

            If txtnew.Text = txtconform.Text Then
                Try
                    strsql = "UPDATE login SET Password= '" & txtnew.Text & "' WHERE Password = '" & txtold.Text & "' "
                    cnsql = New OleDbConnection(strsql)
                    cnsql.Open()

                    cmsql = New OleDbCommand(strsql, cnsql)
                    cnsql.Close()
                    cmsql.Dispose()
                    cnsql.Dispose()
                Catch ex As OleDbException
                    MsgBox(ex.Message, MsgBoxStyle.Critical, "Oledb error")
                Catch exp As Exception
                    MsgBox(exp.Message, MsgBoxStyle.Critical, "General")
                End Try

     </vb>

    Filed under:
    • Post Points: 15
  • Advertisement

    • Red Gate Software

    Advertisement

    Want to boost your .NET application performance?

    Some developers always seem to write efficient and lightening-fast code. What is their secret? It’s ANTS Profiler. “We improved the performance of the application up to 10 times” Dan Ports, Intrigma.

    Try it for yourself now.

  • 05-05-2008 10:17 AM In reply to

    • Bart_K
    • Not Ranked
    • Joined on 02-12-2008
    • United Kingdom
    • Junior Member
    • Points 195

    Re: General Exception occurs

     That's probably because you tried to use the sql string as the connection string

    Try
                   strsql = "UPDATE login SET Password= '" & txtnew.Text & "' WHERE Password = '" & txtold.Text & "' "
                    cnstr = "server=DBSERVER;User id=USER;password=PASSWORD;database=DB"
                    cnsql = New OleDbConnection(cnstr)

                    cnsql.Open()

                    cmsql = New OleDbCommand(strsql, cnsql)
                    cnsql.Close()
                    cmsql.Dispose()
                    cnsql.Dispose()
                Catch ex As OleDbException
                    MsgBox(ex.Message, MsgBoxStyle.Critical, "Oledb error")
                Catch exp As Exception
                    MsgBox(exp.Message, MsgBoxStyle.Critical, "General")
                End Try

    A great resource for connection strings: http://www.connectionstrings.com/

     

     

    • Post Points: 5
  • 05-06-2008 6:59 AM In reply to

    Re: General Exception occurs

    befor closing connection use

    cnsql.ExecuteNonQuery()

    and try

     

    • Post Points: 5
Page 1 of 1 (3 items)