Hello, I need to use this function but not with an odbc string, I want to use another string example:
= "PROVIDER=SQLOLEDB " & _
" ;PASSWORD=123456" & _
" ;PERSIST SECURITY INFO=TRUE " & _
" ;USER ID=sa " & _
" ;INITIAL CATALOG=DEMO " & _
" ;DATA SOURCE=SERVIDORDATADEMO\GODADDYSQL"
This function mentioned below works perfectly but it tells me that ODBC should not be used, could you help me?
Function CreateSPT(SPTQueryName As String, strSQL As String)
Dim cat As ADOX.Catalog
Dim cmd As ADODB.Command
Set cat = New ADOX.Catalog
Set cmd = New ADODB.Command
cat.ActiveConnection = CurrentProject.Connection
Set cmd.ActiveConnection = cat.ActiveConnection
cmd.CommandText = strSQL
cmd.Properties("Jet OLEDB:ODBC Pass-Through Statement") = True
'Modify the following connection string to reference an existing DSN for
'the sample SQL Server PUBS database.
cmd.Properties _
("Jet OLEDBass Through Query Connect String") = _
"ODBC;DSN=myDSN;database=pubs;UID=sa;PWD=;"
cat.Procedures.Append SPTQueryName, cmd
Set cat = Nothing
Set cmd = Nothing
End Function
thank you very much for what you can help me
= "PROVIDER=SQLOLEDB " & _
" ;PASSWORD=123456" & _
" ;PERSIST SECURITY INFO=TRUE " & _
" ;USER ID=sa " & _
" ;INITIAL CATALOG=DEMO " & _
" ;DATA SOURCE=SERVIDORDATADEMO\GODADDYSQL"
This function mentioned below works perfectly but it tells me that ODBC should not be used, could you help me?
Function CreateSPT(SPTQueryName As String, strSQL As String)
Dim cat As ADOX.Catalog
Dim cmd As ADODB.Command
Set cat = New ADOX.Catalog
Set cmd = New ADODB.Command
cat.ActiveConnection = CurrentProject.Connection
Set cmd.ActiveConnection = cat.ActiveConnection
cmd.CommandText = strSQL
cmd.Properties("Jet OLEDB:ODBC Pass-Through Statement") = True
'Modify the following connection string to reference an existing DSN for
'the sample SQL Server PUBS database.
cmd.Properties _
("Jet OLEDBass Through Query Connect String") = _
"ODBC;DSN=myDSN;database=pubs;UID=sa;PWD=;"
cat.Procedures.Append SPTQueryName, cmd
Set cat = Nothing
Set cmd = Nothing
End Function
thank you very much for what you can help me