I've been playing around with Vb.net connecting to a SQL server 2000. I feel like the connection could be improved. I'm just not sure how. I am still new to VB so go slow for me and detailed for me.



Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

con.ConnectionString = ConnectionString
'call pickfield sub (starts the SQL Query generation)
PickFields()


da = New SqlDataAdapter(sqlQuery, con)
'con.ConnectionTimeout = 0
con.Open()
'Command.commandtimeout = 0
'still getting timeout on large (timewise) narrative searches
da.SelectCommand.ExecuteNonQuery()

Try
da.Fill(ds, p)
con.Close()
DataGridView1.DataSource = ds.Tables(p)
Catch ex As Exception
MessageBox.Show(ex.ToString)

End Try
'opens the results tab
TabControl1.SelectTab(2)
'MsgBox("databse close")
End Sub

Also I'm having issues with a timeout when I run very time consuming queries. This is the error "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
The statement has been terminated."
I know that this is probably not the right place to ask for help about that but if anyone has advice please let me know.