-
October 10th, 2013, 02:08 AM
#1
connect to sql server 2005 via text file( with .ini extension)
file settings.ini
[Connection_String]
Driver={SQL Server}
Server=113.160.248.114,1434
Database=Northwind
Uid=xyz
Pwd=123
Trusted_Connection=yes
Dim MyConnect As New ADODB.Connection
Dim MyRecSet As New ADODB.Recordset
Dim strSQL As String
Dim COMMFilePath As String
COMMFilePath = GetINISetting("COMM", "FilePath", Application.Path & " ")
MyConnect.Open _
"Driver={SQL Server};" & _
"Server = Trim(GetINISetting("Connection_String", "Server", Application.Path & " SETTINGS.INI"));" & _
"Database = Trim(GetINISetting("Connection_String", "Database", Application.Path & " SETTINGS.INI"));" & _
"Uid = Trim(GetINISetting("Connection_String", "Uid", Application.Path & " SETTINGS.INI"));" & _
"Pwd = Trim(GetINISetting("Connection_String", "Pwd", Application.Path & " SETTINGS.INI"));" & _
"Trusted_Connection = Trim(GetINISetting("Connection_String", "Trusted_Connection", Application.Path & " SETTINGS.INI"));"
My code above fails, do not work or who have read the example text file. Ini shared with me. thanks
-
October 10th, 2013, 03:34 PM
#2
Re: connect to sql server 2005 via text file( with .ini extension)
Is your database even set up to allow remote connections?
Always use [code][/code] tags when posting code.
-
October 10th, 2013, 11:19 PM
#3
Re: connect to sql server 2005 via text file( with .ini extension)
Try without the port #
Code:
Server=113.160.248.114
-
October 11th, 2013, 01:06 AM
#4
Re: connect to sql server 2005 via text file( with .ini extension)
I'm looking for example to connect SQL Server instance via ini file or a separate file connectivity to SQL Server I own a configuration file for multiple computers
-
October 11th, 2013, 01:25 AM
#5
Re: connect to sql server 2005 via text file( with .ini extension)
Using an ini file makes no difference, provided that you have the correct values in the ini file then it would work just as if they were hard coded.
That said you had another thread where the values were hard coded and it was not working and if you have not solved that issue then using an ini file is just adding to the possible areas where you may have a problem.
You also did not answer the question as to if the server is setup to allow remote connections.
I seem to remember you saying that you were able to connect on your local machine but when trying to connect to the db on a remote machine you could not connect. If that be the case then an ini file is not going to help. You need to make sure the server is set to allow remote connections and make sure you are using the correct connection info. You also need to make sure that port is not blocked by the firewall.
Also you say it fails but not even a hint as to what actually happens, error message?
Hard to provide help when you do not provide enough info.
Always use [code][/code] tags when posting code.
-
October 14th, 2013, 03:51 AM
#6
Re: connect to sql server 2005 via text file( with .ini extension)
Hi DataMiser! Thank you to read my question. the connections are done. I want to delete the user's abc Northwin an error, you can see my attached image file.
-
October 14th, 2013, 10:45 AM
#7
Re: connect to sql server 2005 via text file( with .ini extension)
Well that question has nothing to do with VB at all, but the error message is telling you what the problem is. It says that the user owns a schema and can not be deleted which means you would need to remove the schema and any other objects owned by that user first.
Always use [code][/code] tags when posting code.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|