Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem connecting to SQLEXPRESS with DataGridView

Status
Not open for further replies.

fergmj

Programmer
Feb 21, 2001
276
US
I am using VS2005 (VB.NET) Professional.

I installed a SQLEXPRESS and yes I am allowing remote connections via TCP/IP and shared memory -- not named pipes or VIA.

I got this code working on my office machine but it isn't working with my home machine.

The code connects perfectly when I am writing to the database but when I try to view data in a DataGridView, I get an error.

Here is the code
Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Try
Me.SCHEDULETableAdapter.FillByClient1(Me.CABLEDataSet.SCHEDULE, CType(Client_NoTextBox.Text, Long))
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
DataGridView1.Visible = True
End Sub

Nothing fancy there. I am putting a list of customers into a drop down. When I choose one from the drop down, I am using the client number associated with that (reading from the client table)

When I click a button I want it to return all of the invoices (schedules) for that client. but instead I get an error:

"An error has occurred while connecting to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error locating server/Instance Specified)

Just as a reference yes the firewall is properly permissioned for the TCP ports and the sqlserver and I am running sqlbrowser and that is permissioned in the firewall also.

Thanks for any help. I have uninstalled the SQL Server and re-installed etc. Nothing is working.

Thank you!
 
OK I think I solved this. The problem was in the TableAdapter. It was referencing something from my office machine. Once I deleted that and re-did it....all seems good now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top