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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC works application doesnt.

Status
Not open for further replies.

griffitd

Programmer
Aug 20, 2002
189
GB
Hi
I have an application that connects to sql 2005 express.
On 3 pcs it works fine but on on windows 7 pc it fails to connect to the sql server express

I have tested using ODBC. setup this using named pipes with the sa user and it works fine but the application doesn't work.

Can anyone point me at something??

Thanks
 
Hi,

"but the application doesn't work."

I assume that you mean on the Windows 7 PC?

What "doesn't work" actually mean?
 
Sorry
I was a bit vague.

The application fails to connect to the SQL Server. It is windows 7. we have 4 pcs 3 connect ok. and 1 doesn't.

In the code I create a sql command and set the connection string.

when I execute the open connection it just hangs and after 30 seconds fails.
application string is

msConnectstring = "Data Source=" & msDBServer & ";" & _
"Initial Catalog=" & msDBDatabase & ";" & _
"User ID=" & msDBUser & ";" & _
"Pwd=" & msDBPwd & ";" & _
"Application Name=Rotabase;"
this works as its ok on the other pcs.

Dim mConnectionString As String
Dim mcmdSQLCommand As SqlCommand
Dim moTransactionScope As TransactionScope
Dim mnTimeout As Integer = 300

Public Sub BuildSP(ByVal StoredProcedureName As String)
Try
If Not mcmdSQLCommand Is Nothing Then mcmdSQLCommand.Cancel()
mcmdSQLCommand = New SqlCommand()
With mcmdSQLCommand
.CommandText = StoredProcedureName
.CommandType = CommandType.StoredProcedure
.Connection = New SqlConnection(mConnectionString)
.CommandTimeout = mnTimeout
End With
Catch ex As SqlException
Throw New Exception("SQLException|" & ex.Number.ToString.TrimStart & "|" & ex.Message)
Catch ex As Exception
Throw New Exception(ex.ToString)
End Try
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top