CurrentProject.OpenConnection ignores default language

S

Simon Francesco

It appears to me that the CurrentProject.Connection object ignores the SQL
Login's default language setting when using an ADP project.

If I execute the two pieces of code below I get different results.
I use a login form that calls CurrentProject.OpenConnection, but the
resultant CurrentProject.Connection dis-respects the SQL default language of
the user.
Can anyone tell what I am doing wrong or confirm that the OpenConnection
method has a bug.

Sub TestLanguage(useConnectionObject As Boolean)

Dim cn As ADODB.Connection
If useConnectionObject Then
Set cn = CurrentProject.Connection
Else
Set cn = New ADODB.Connection
cn.ConnectionString = CurrentProject.Connection.ConnectionString +
";Password=tes7Ing"
cn.Open
End If

Dim rs As ADODB.Recordset
Set rs = cn.Execute("SELECT @@Language")

Debug.Print rs(0)
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing

End Sub

TestLanguage(False)
British 'CORRECT
TestLanguage(True)
us_english 'INCORRECT


TIA
Simon
 
H

hassan

Simon Francesco said:
It appears to me that the CurrentProject.Connection object ignores the SQL
Login's default language setting when using an ADP project.

If I execute the two pieces of code below I get different results.
I use a login form that calls CurrentProject.OpenConnection, but the
resultant CurrentProject.Connection dis-respects the SQL default language
of
the user.
Can anyone tell what I am doing wrong or confirm that the OpenConnection
method has a bug.

Sub TestLanguage(useConnectionObject As Boolean)

Dim cn As ADODB.Connection
If useConnectionObject Then
Set cn = CurrentProject.Connection
Else
Set cn = New ADODB.Connection
cn.ConnectionString = CurrentProject.Connection.ConnectionString +
";Password=tes7Ing"
cn.Open
End If

Dim rs As ADODB.Recordset
Set rs = cn.Execute("SELECT @@Language")

Debug.Print rs(0)
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing

End Sub

TestLanguage(False)
British 'CORRECT
TestLanguage(True)
us_english 'INCORRECT


TIA
Simon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top