Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL Server cid

Author  Topic 

sfjtraps
Yak Posting Veteran

65 Posts

Posted - 2014-01-27 : 13:22:30
I'm trying to connect to SQL Server Express from an application that is on the same computer as SQL Server Express. What is the syntax for establishing a SQL Server connection id?

Any help would be appreciated.

Thanks,

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2014-01-27 : 14:01:55
https://www.connectionstrings.com/sqlconnection/attach-a-database-file-on-connect-to-a-local-sql-server-express-instance/

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

sfjtraps
Yak Posting Veteran

65 Posts

Posted - 2014-01-27 : 15:07:47
Is there a simple way to test my connection ID inside SQL? It is not working in the application, so I wanted to see if I could eliminate any application issue.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-01-27 : 15:10:57
Use this to test it: http://www.gotknowhow.com/articles/test-a-database-connection-string-using-notepad

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

sfjtraps
Yak Posting Veteran

65 Posts

Posted - 2014-01-27 : 15:26:52
The udl file is connecting fine, but I'm still having issues with the actual connection string in the application.
Go to Top of Page

sfjtraps
Yak Posting Veteran

65 Posts

Posted - 2014-01-27 : 15:27:23
Is there a way to get the actual output from the udl?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-01-27 : 15:29:46
What error are you getting? Let's start with that.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

sfjtraps
Yak Posting Veteran

65 Posts

Posted - 2014-01-27 : 16:22:11
Actually, I'm still working on that, because the application is stating 'No Errors Occurred'. However I know that's not true because I purposely changed the cid to something false and it still stated 'No Errors Occurred'.

This is the cid I'm attempting to use:
"data source=mycomputer\SQLEXPRESS;initial catalog=Test_SerialNumber;User Id=sa;
Password=barney;"
Go to Top of Page

sfjtraps
Yak Posting Veteran

65 Posts

Posted - 2014-01-28 : 09:11:12
I got it up and running. The problem was the syntax on the application side. Because the application in called Wonderware InTouch, it requires its own syntax to connect to SQL Server Express, as follows:

ResultCode = SQLConnect(test_Cid, "Provider=SQLOLEDB.1;User ID=sa;Password=barney;Initial Catalog=database;Data Source=mycomputer\SQLEXPRESS");


ResultCode is just a way to troubleshoot errors between the application and SQL, and test_Cid is a session ID (memory integer) used to open and close the cid.
Go to Top of Page

sfjtraps
Yak Posting Veteran

65 Posts

Posted - 2014-01-28 : 09:11:49
Thank you for your help!
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-01-28 : 13:41:46


Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -