Group:  Microsoft Access ยป microsoft.public.access.adp.sqlserver
Thread: CurrentProject.OpenConnection ignores default language

Geek News

CurrentProject.OpenConnection ignores default language
Simon Francesco 12/11/2008 1:42:01 AM
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 [ at ][ at ]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
Re: CurrentProject.OpenConnection ignores default language
"hassan" <kataoka19700805[ at ]yahoo.com> 12/15/2008 2:52:23 PM

"Simon Francesco" <SimonFrancesco[ at ]community.nospam> wrote in message
news:34F42A02-CC5A-4B59-ABB2-9D95A7DD37EB[ at ]microsoft.com...
[Quoted Text]
> 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 [ at ][ at ]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

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net