Showing posts with label below. Show all posts
Showing posts with label below. Show all posts

Thursday, March 22, 2012

ConnectionString using SQL Server

Hello all,

I tried several connectionstrings in web.config file shown below and got this error "Application Error" (ErrorPage.htm).

<add name="ClubSiteDB" connectionString="Data Source=myClubs;Initial Catalog=Clubs;User Id=xxxx;Password=xxxx;" providerName="System.Data.SqlClient"/>
<add name="ClubSiteDB" connectionString="Driver={SQL Server};Server=localhost;Database=clubs;Uid=xxxx;Pwd=xxxx;" providerName="System.Data.SqlClient"/>

I created SQL Server 2000 database called clubs and ODBC DSN called myClubs at web hosting. It worked at local machine with no problem, but transfer from local machine to web hosting is something I'm not familiar with. Please advice. Thanks.

EagleGolf

check out www.connectionstrings.com|||

Hi!,

U have to specify the server name rather than 'localhost', if u r using trusted connection then it should be:
Database=Test;Server=Machine1;Trusted_Connection=Yes,
If not then specify the Userid and password:
server=Machine1;database=test;uid=xxx;pwd=xxx

Hope this will help
Regards

|||

The server name would be the url connected to the database. Or just the name like .\SQLEXPRESS? I use your method and it didn't work like it should.

|||

Hi,

Are u using SQL Express? If yes, then check this URL:

http://www.eggheadcafe.com/articles/20060719.asp

Hope this will help.

Regards

|||

I finally figured it out. I had the server name wrong and now it is corrected. Thanks for all of your help. Have a nice day.

Tuesday, March 20, 2012

connectionstring gets populated unwillingly

Hi,
I hav eplaced an expression for the flat file connection as below

@.[User::FileDirectory] + @.[User::FileName]

This is supposed to be used instead of the ConnectionString property of the flat file connection.

You can see that I have created two variables.

The variable
@.[User::FileDirectory] is set to the directory. i.e. I have hardcoded the path to it and assigned it to this variable.

The variable @.[User::FileName] is picked up automatically.

The question is:

When I go to the properties of the flat file connection, I delete the value inside the connectionstring property becuase there is now the expression which is set to the connectionstring.
But when I come back to this property then I am not sure why the connectionstring property gets populated with the directory that I hardcoded to the variable.

Many thanks

arkiboys wrote:

Hi,
I hav eplaced an expression for the flat file connection as below

@.[User::FileDirectory] + @.[User::FileName]

This is supposed to be used instead of the ConnectionString property of the flat file connection.

You can see that I have created two variables.

The variable
@.[User::FileDirectory] is set to the directory. i.e. I have hardcoded the path to it and assigned it to this variable.

The variable @.[User::FileName] is picked up automatically.

The question is:

When I go to the properties of the flat file connection, I delete the value inside the connectionstring property becuase there is now the expression which is set to the connectionstring.
But when I come back to this property then I am not sure why the connectionstring property gets populated with the directory that I hardcoded to the variable.

Many thanks

This is by design. The connectionstring property is picking up the value from the expression. Don't worry about it. It will be correct at runtime.|||

I'm not sure if this is correct because in the connectionstring property it shows:

\\gblond088s0b\D$\ApplData\CEM\WorkingTemp\

and in the expressions it shows:

@.[User::FileDirectory] + @.[User::FileName]

Please note that in the variable design I have manually assigned the variable @.[User::FileDirectory] to the path above

Thanks

|||

I forgot to mention that it gives the following error:

Error: 2007-07-26 18:10:05.39
Code: 0xC020200E
Source: Data Flow Task Flat File Source [1]
Description: Cannot open the datafile "\\gblond088s0b\D$\ApplData\CEM\WorkingTemp\".
End Error

so basically, it is not seeing the filename. it only sees the directoryname

Thanks

|||

arkiboys wrote:

I forgot to mention that it gives the following error:

Error: 2007-07-26 18:10:05.39
Code: 0xC020200E
Source: Data Flow Task Flat File Source [1]
Description: Cannot open the datafile "\\gblond088s0b\D$\ApplData\CEM\WorkingTemp\".
End Error

so basically, it is not seeing the filename. it only sees the directoryname

Thanks

Right. You need to give the Filename variable a default value. And if, during runtime, it still cannot find the data file, then you aren't populating the Filename variable correctly.|||

This is strange.
If I use a loop and give it the full directory path as described before, the foreach loop picks up the filenames and runs the package successfully. But I do not want to use a loop.

The package gets called once per filename. So the filename gets passed to the package and I want it to run but obviously it does not.

Not sure why the filename does not get populated when it is being passed to the package.

Thanks

|||How are you populating the Filename variable otherwise?|||

I have created a variable called @.FileName.

There is also a flat file connection which has a path to the directory as described before.

There is a command prompt which someone else is in charge of running, at the end of this command it passes the filename.

How do you think the filename should get populated?

note that I do not have this problem when I use a foreach loop but for this project loop is not required.

Thanks

|||

arkiboys wrote:

I have created a variable called @.FileName.

There is also a flat file connection which has a path to the directory as described before.

There is a command prompt which someone else is in charge of running, at the end of this command it passes the filename.

How do you think the filename should get populated?

note that I do not have this problem when I use a foreach loop but for this project loop is not required.

Thanks

I'm asking HOW you are passing a value to the Filename variable. HOW is the command line, that someone else is in charge of executing, populating the Filename variable? You need to know this before asking your questions here.|||

Ok,
If I want to run the package myself, how can I do this using the command line?

|||DTEXEC /FILE "Path to your package" /SET "\Package.Variables[Namespace::VariableName].Properties[Value]";YourValue

Monday, March 19, 2012

ConnectionOpen(Connect()) in SQL server 2000

hi,
i am new to SQL Server 2000 n trying to set up a Server in Windows 200
pro,
but whenever i try to Register the server it fails n gives the below
error,
ConnectionOpen(Connect()) faIled.
plz if some one can rectify this issue,
thanks in advance,
mandeepFirstly check if your SQL Server services are running; If yes then
proceed
Start-->programs --> Microsoft SQL Server --> Client Network Utility
Check to see if TCP/IP and NamedPipes are enabled only check if Shared
Memory is checked, if its not checked, check it

Tuesday, February 14, 2012

Connection String

Can someone please tell me why my connection below is not working?
using System.Data.OleDb;
OleDbConnection conn = new OleDbConnection("Provider=SqlOleDb;Data Source=BLOOD;Initial Catalog=Test;");
//Tried Above as ...;Initial Catalog= Test")
conn.Open();You need to install the database engine software (SQL Server, based on your connection string), and properly configure the server and the database before you can connect to them.

Once you get your server setup you may get error messages. Those would help us a lot in futher diagnosing your problem(s)!

-PatP

connection sql server problems

What is the problems of my code to connect sql database below : thx!
Code:
Dim objConn As New OleDbConnection()
objConn.ConnectionString = "Data Source=localhost;IntegratedSecurity=SSPI;user id=sa; password=sa;Initial Catalog=rental"

objConn.Open()
Error :

An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.ArgumentException: An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'.
Source Error:
Line 7: Line 8: Dim objConn As New OleDbConnection()Line 9: objConn.ConnectionString = "Data Source=localhost;IntegratedSecurity=SSPI;user id=sa; password=sa;Initial Catalog=rental"Line 10: Line 11: objConn.Open()
Your connection string is appropriate for a SqlConnection object. If you want to use an OledbConnection (which is slower), you'll have to specify Provider=sqloledb
Marcie

Sunday, February 12, 2012

connection problems

Hello,

My application is having a problem connecting to its database. The error I am getting is below...

Can anyone give me a pointer on how to fix the problem... I am guessing I need to increase the authentication or change how the database is accessed?

thanks

Cannot open user default database. Login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.Data.SqlClient.SqlException: Cannot open user default database. Login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

Hi,

This means that your ASPNET worker ('NT AUTHORITY\NETWORK SERVICE')does not have access to your datasource.

If you are using SQL Server, there stages of the SQL server access which you have to set in your SQL Server:

1. Add login users in your SQL Server (add your ASPNET worker)

2. Grant access to database to this

3. Grant access to dabase object (Stored procs, tables, etc)

I hope this helps.

Cheers,

Wilmar, KSA (Mabuhay!)