Forum Discussion

lbyrne's avatar
lbyrne
Contributor
11 years ago

Connection string not working


Set



SProc = ADO.CreateADOStoredProc



I tried



SProc.ConnectionString = "Provider=SQLOLEDB.1;User ID=autotest_sa;Password=testing123;Initial Catalog=AUTOTEST;Data Source=TESTDB" and



SProc.ConnectionString = "Provider=SQLOLEDB.1;User ID=autotest_sa;Password=testing;Initial Catalog=AUTOTEST;Data Source=192.168.48.244"



Receive the following error when I try to execute stored procedure



Parameter object is improperly defined. Inconsistent or incomplete information was provided





Tried many variations unable to get working


 



 


8 Replies

  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor
    You are missing the Location parameter in your connection string.

    You need to include Location = pathtodatabase;





    Provider=SQLBaseOLEDB;Data source=myServerAddress;Location=myDataBase;

    User Id=myUsername;Password=myPassword;
  • I am new to SQL server. There are multiple files. How do I know which file to supply? I thought I could use the connection information specified in one of the DBTables stores.



  • I tried the following connection string



    Provider=SQLOLEDB.1;User ID=autotest_sa;Password=testing123;Initial Catalog=AUTOTEST;Data Source=TESTDB



    I get the following error



    Parameter object is improperly defined. Inconsistent or incomplete information was provided..



    I got this connection information from one of the DBTables stores I created.



    One of the replies to my post was to include the parameter Location.



    Based on what I read, this is the path to the file location.



    That was not necessary when I set up the DBTables store. 



    Is this necessary? 
  • I don't use location in my SQL connection string? And it works fine.



    Looking at the one I'm using, the only thing it contains that yours doesn't is:


    Persist Security Info=False;



    ... which is inbetween the Provider and User ID parameters.



    Not a SQL expert myself so not sure how much (if any) difference that would make?




    ** EDIT **



    On looking again, the "Data Source" I supply is the computer name. So "localhost" if the DB is on the same computer that TestComplete is running on I believe.

     



  • I tried adding the Persist parameter - same error.



    The data source is a remote server. Could that be the problem? The database I need to refer to does not reside on the same server as Test complete.







    SProc.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=autotest_sa;Password=testing123;Initial Catalog=AUTOTEST;Data Source=TESTDB"


  • That's your problem then.



    You need to tell it where to find the remote machine.



    Never used it to connect to a remote machine myself. Bit more to it (not surprisingly) than if it's on the local machine.



    Maybe start here: https://social.msdn.microsoft.com/Forums/windows/en-US/0be3b9b8-1a1f-44e0-86f3-010c1ed9159d/creating-a-connection-string-to-remote-sql-server?forum=winforms



    Which seems to go into a bit of detail around it. Firewalls, SQL settings, etc etc that may need fiddled with.