my sql timeout expired in vb.net using data adapter
  
Error :timeout expired the time out period to completion of the operation or the server is not responding
Solution
Public Function read(ByVal str As String) As DataTable
        Dim dt As DataTable = New DataTable()
        Try
            Dim sql As MySqlCommand = New MySqlCommand(str, con)
            Dim DataAdapter1 As MySqlDataAdapter = New MySqlDataAdapter()
            DataAdapter1.SelectCommand = sql
        DataAdapter1.SelectCommand.CommandTimeout = 0
            DataAdapter1.Fill(dt)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        Finally
            If con.State = ConnectionState.Open Then
                con.Close()
            End If
        End Try
        Return dt
    End Function
Subscribe to:
Comments (Atom)

