Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, November 22, 2024 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Web Forums - ASP/ASP.NET/Web Services/Other
Forum to discuss building external web applications for SalesLogix. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to ASP/ASP.NET/Web Services/Other | New ThreadView:  Search:  
 Author  Thread: aspnet SQLException from VS2005...
Snow Monkey
Posts: 214
 
aspnet SQLException from VS2005...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Sep 07 4:29 PM
I am trying to connect a Login contro with my existing sql server 2000 db using the SLXOLEDB provider and doesnt work.

throws this error..

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider,error:40-Could not open connection to SQL Server))

<connectionStrings>
<add name="SLXConn" connectionString="Provider=SLXOLEDB.1;Data Source=crmtestersist Security Info=Trueassword=XXXX;User ID=sa;Initial Catalog=testdb01" providerName="System.Data.OleDb"/>

</connectionStrings>
This is the code when login1 login control executes...

bool boolReturnValue = false;
string strConnection = ConfigurationManager.ConnectionStrings["Dorknozzle"].ConnectionString;
SqlConnection Connection = new SqlConnection(strConnection);
String strSQL = "Select * From Contact ";
SqlCommand command = new SqlCommand(strSQL, Connection);
SqlDataReader Dr;
Connection.Open();
Dr = command.ExecuteReader();

When the above is executed , Connection.Open(); fails with t he above error.

This machine has Vs2003, VWD2005 Express edition already installed.I am trying to connect to a sql 2000 db. and i dont have sql2005 in this machine.

Any reason why this happens?I am NOT even using sql 2005 on my server or in my client machine.

[Reply][Quote]
Mark Dykun
Posts: 297
 
Re: aspnet SQLException from VS2005...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Sep 07 11:25 AM
Cannot see the whole connection string, however it seems strange that the providername attribute is "System.Data.OleDb" whereas you are creating a new SQLConnection object. You are not connecting through the saleslogix provider based on what little of the connection string I can see.

1. Through the provider the User ID would not be SA, it would be Admin or some other user

Mark
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: aspnet SQLException from VS2005...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Sep 07 11:41 AM
I fixed the post so the full connection string would show, those darn < and >.

Anyway, I think you're mixing up some stuff here, as Mark pointed out, between a SQL connection and a SLX connection. You appear to be attempting to use a SLX connection string, since it lists "SLXOLEDB.1" as the provider, however, the rest of the connection string appears to be a SQL connection, not a SLX one.

Take a look at this article here for details on creating a valid SLX connection string: http://www.slxdeveloper.com/page.aspx?action=viewarticle&articleid=55

Also, you could create a new text file, rename it to "something.UDL" (drop the .Txt extension), then double-click it. Define the SLX connection and close. Then open the UDL file in Notepad and you'll have your connection string (make sure you check the box to save the password so it gets saved in the UDL file for you as well. You could also use the utility I've posted here as well to create the connection string: http://www.slxdeveloper.com/page.aspx?action=viewarticle&articleid=36

-Ryan
[Reply][Quote]
Snow Monkey
Posts: 214
 
Re: aspnet SQLException from VS2005...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Sep 07 10:47 AM
Mark and Ryan , Thanks for answering...

I was using a snippet of code from a book(first time using vs 2005).I was trying out this control(without RTFM) and your right in pointing out that i got mixed up using the slx and sql oledb provider.Infact saw this crazy error of the program expecting a sql 2005 server and NOT a 2000 server and was only interested in opening the connection(didnt matter what sorta connection it was).

Also i was using the VWD Express;so thought for a second that they might have locked down the express version to use only a LOCAL sql 2005 server and could not use this to connect to Enterprise remote sql 2000 servers.

However , after a little while i figured out what the problem was..it was the sql server port issue where the code was using the default.(we use diff ports here for sql) and i had to create a sql client alias to use the correct port.

Now one question stands, Why did my UDL worked when my sql based connection was tested thru data link manager and 2005 wouldnt open up a connection thru a SQLClient provider?

Also i tried a datasource control in another page and tried using the connection string from that control there and that also didnt make any difference for 2005.

[Reply][Quote]
Mark Dykun
Posts: 297
 
Re: aspnet SQLException from VS2005...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Sep 07 7:20 AM
Nandu,

More then likely when you were using DataLink Manager it was using the proper provider. You then copied the Conn String and forced it to use the SQL provider and as such would have been invalid.

My Guess,
Mark
[Reply][Quote]
Snow Monkey
Posts: 214
 
Re: aspnet SQLException from VS2005...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Sep 07 9:02 AM
thanks Mark for answering!
afraid, your guess is wrong.I had the correct provider and the used the correct connection client class to get the connection and stuff.I am certain that the port number was the issue.

Now i changed the port to use the default and removed the alias and guess what... the same error!!

SLX connection and OleDb connection is something i started trying just before i posted the code .All through i was using the regular connection string with the Sql client for getting my connection.
[Reply][Quote]
Mark Dykun
Posts: 297
 
Re: aspnet SQLException from VS2005...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Sep 07 7:08 AM
You are welcome to send me a code sample to look at. mdykun@acastle.com

Mark
[Reply][Quote]
Snow Monkey
Posts: 214
 
Re: aspnet SQLException from VS2005...Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Sep 07 1:48 PM
I tried to paste code here.Seems it needs a ryan farley tag to display it ..so sending you an email..

and hey! and i dont know why your mail domain look very familiar to me?...........
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 11/22/2024 9:49:14 PM