Showing posts with label local. Show all posts
Showing posts with label local. Show all posts

Tuesday, March 27, 2012

attach db

How can I attach a remote db via Enterprise Manager or Query Analyzer?
Am I wrong if I launch a "sp_attach" sql file (from my local machine) to the remote server?
Do I really have to detach local db before?
Please can someone just tell me how he did?

SaoriHi saori,
1. Did you try to post your question in the DBA section of these forums:

http://www.sqlteam.com/Forums/


http://www.sql-server-performance.com/forum/default.asp

2. Hope some DBA will help you.|||Thanks for the answer.
I'll (quickly) give it a try.

(I posted a msg there 'cause it is above all a question of method about sql server tools)

Saori|||Honestly, I attach remote db's by creating a new registration. Unless you mean something else like fiberchanneling or something, but as for having your SQL Enterprise Manager utilize a Remote SQL Server, just create a new registration.

For T-SQL based methods, you're not necessarily attaching. I'd say it's more Linked Server, or Using Remote Servers. check books online for those two in the Index tab.

SP_LinkedServers and the other method would be actually using the enterprise manager to create the registration.|||Saori,

You didn't clearly define your question about what you want to 'attach', but I think I have understood what you were saying. I would redefine your question with several possible solutions.

Assume, you have a local SQL server in your machine, and there is another SQL server in a remote machine. There is a database called pubs1 existing in the remote SQL server. You want it APPEARS ('attach') in your SQL server.

1. Logical APPEAR:
As KraGiE suggested you could make a new Server Registration in your local SQL Enterprise Manager to LINK to that remote SQL server. In this way, you would bring the whole SQL server including the pubs1 into your local SQL Enterprise Manager.

However, to do so, you need to have the access to the database, say: machine name, login name and password. It is possible that you could only access one database in that server, say, pubs1. But that is enough for you. By the way, if the remote server is not within your LAN, and need to be linked through HTTP, you should have the server IP address and also the access to possible firewall.

I called this kind of 'attach' as logical APPEARS, because the database is not physically in your machine, but still at the remote server. You can only access the database through your Enterprise Manager. The database pubs1 appearing in your Enterprise Manager is just a pointer linked to the remote server.

2. Physical APPEAR:
In short, get a physical copy from the remote server and 'attach' it to your local server.

Step 1:
Copy the database file and the log file into your local machine. In this case, pubs1 files are located by default at:
C:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs1.MDF
C:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs1_log.LDF
You need shut down the remote database for copy/past, otherwise, it wouldn't work.

Step 2:
from Enterprise Manager, right click the Databases object in your local SQL instance, choose all tasks --> attach database ... . From the Attach Database window, choose your database file, pubs1, and then OK.

3. If you didn't have SQL 2000, instead of SQL 7.0, then the Step 2 would not avaiable in Enterprise Manager. You would have to use the command 'sp_attach_db' to do the job. Something like:


EXEC sp_attach_db @.dbname = N'pubs',
@.filename1 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs1.mdf',
@.filename2 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs_log1.ldf'

4. Finally, if you even didn't have SQL server 7.0, you couldn't do the trick of 'attach'. But, you could do the job with SQL server 6.5 Enterprise Manager 'Database/Object transfer' tool given you have access to the remote database, where there is equivalent tools in both SQL 7.0/2000, called Import Data/Export Data, but not as easy used as the ATTACH method.

Hope this helps.|||Thanks Phuoc, KraGiE and ghan.
This really helped me understand essential issues.

Great analysis , ghan (copied in my notepad)!
Just one little thing:
When I attach db via Enterprise Manager, do I automatically transfer log file as well?|||saori,

I am really happy to hear that. You know what, when I made some analyses to other people, I just summarize what I have done and clear my understanding about this issue myself.

When I attach db via Enterprise Manager, do I automatically transfer log file as well?

You see the example:


EXEC sp_attach_db @.dbname = N'pubs',
@.filename1 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs1.mdf',
@.filename2 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs_log1.ldf'

There are two files, one is *.mdf, the data file, another is *.ldf, the log file.

When you use enterprise manager to do the job, you will see, (at STEP 2) you only need browse the *.mdf file in, while the *.ldf file will be brought in automatically, assuming you have copied the two files into the same directory (Step 1).

Good luck.|||I have a project lets say project1. I have a copy of it running on my development server and a copy of it on my production server. I have detached db from development server and attached it to my production server. I can work in db using Enterprise manager but when I try to run my applications it doesnt work. I know why it doesnt work its because its looking for user developmentserver and now its on productionserver. Is there a way to set permissions for user productionserver without having to do every table and stored procedure one at a time? I would like to do it quickly and efficiently and doing all by hand one at a time is neither.
Please help.|||There is a security issue. You must use Windows Authentification, instead of SQL Server Authentification. You might change your connection string to use SQL Server authentification. If you want to keep to use windows authentification, you need to setup your security in your production server to make your application assistent with your SQL server.

Sunday, March 25, 2012

Attach database

I have a database on a server and want to put it my local laptop that also has sql express. I attached the db, I see it in Management Studio but it does not show up in

C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data so my app is not working correctely. How do I get the db to show up in the MSSWL\Data folder. I'm a bit confused.

Attaching a DB to SQL Server does not move the DB file. If you want the DB file to be in a particular directory then you need to move the file to that directory and then attach the DB file to SQL Server.

|||Ok I copied the db to the data folder and then attached it. I can connect but but I get an error "connot find server\instance.|||Then it has nothing to do with the directory of the file. That means that what "MSSWL\Data" is the name of a "named" instance of Sql Server. In that case you will need to configure\modify the application so it can connect to the Sql Server installed on your machine. As it looks now the application is trying to connect to the server from where you got the database file.|||

Need some more info here, when are you getting this error? If you can't find the server, you are not able to connect as you suggest. A few other questions:

What is the name of your instance?
Have you confirmed that it's running in SQL Configuration Manager?
Are you able to connect from the local computer? (i.e. where Sql Express is installed.)

Thanks for the additional informaiton.

Mike

|||

I fugured it out. I put the db and dblog in the data folder and then attached it..it works fine now.

Thanks much

|||

Good to hear it's working.

Mike

Thursday, March 22, 2012

Attaach 2000 data file from network drive

Hi
How can I attach mdf file without copying it to local disk.
I dont have enough space on the server which I have to attach db. But there
is enough space on an other server in the network.
Thanks
BanuYou will need to set this trace flag to enable
dbcc traceon(1807)
Be aware that this isn't entirley supported by Microsoft and any network
delays can lead to corruption. Also performance will suffer...
HTH. Ryan
"Banu_tr" <abuslu@.hotmail.com> wrote in message
news:D8AB0981-FBDF-479F-B09E-D5B1A5289D60@.microsoft.com...
> Hi
> How can I attach mdf file without copying it to local disk.
> I dont have enough space on the server which I have to attach db. But
> there
> is enough space on an other server in the network.
> Thanks
> Banu|||Dear Ryan,
I execute the dbcc traceon(1807) . But still couln't see the mapped network
drive when I try to attach the mdf file.
What else should I do?
"Ryan" wrote:

> You will need to set this trace flag to enable
> dbcc traceon(1807)
> Be aware that this isn't entirley supported by Microsoft and any network
> delays can lead to corruption. Also performance will suffer...
> --
> HTH. Ryan
> "Banu_tr" <abuslu@.hotmail.com> wrote in message
> news:D8AB0981-FBDF-479F-B09E-D5B1A5289D60@.microsoft.com...
>
>|||Banu_tr wrote:
> Dear Ryan,
> I execute the dbcc traceon(1807) . But still couln't see the mapped networ
k
> drive when I try to attach the mdf file.
> What else should I do?
> "Ryan" wrote:
Make sure you refer to the network path with the UNC name rather than a
drive letter. Like:
EXEC sp_attach_db 'JUNK',
'\\SERVER\share\MSSQL\data\JUNK.mdf',
'\\SERVER\share\MSSQL\data\JUNK_log.LDF'
or:
EXEC sp_attach_db 'JUNK',
'\\SERVER\C$\MSSQL\data\JUNK.mdf',
'\\SERVER\C$\MSSQL\data\JUNK_log.LDF'
IMO running a database from a network drive is a near suicidal thing to
do if you care about the integrity or availability of your data. Do
this for a READ-ONLY or SINGLE USER database only. Make sure you have a
current backup BEFORE you attempt it. Don't expect decent performance
or reliability.
Read:
http://support.microsoft.com/defaul...kb;en-us;304261
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||Dear David,
I still got the message "Device Activation Error"
any advice?
"David Portas" wrote:

> Banu_tr wrote:
> Make sure you refer to the network path with the UNC name rather than a
> drive letter. Like:
> EXEC sp_attach_db 'JUNK',
> '\\SERVER\share\MSSQL\data\JUNK.mdf',
> '\\SERVER\share\MSSQL\data\JUNK_log.LDF'
> or:
> EXEC sp_attach_db 'JUNK',
> '\\SERVER\C$\MSSQL\data\JUNK.mdf',
> '\\SERVER\C$\MSSQL\data\JUNK_log.LDF'
> IMO running a database from a network drive is a near suicidal thing to
> do if you care about the integrity or availability of your data. Do
> this for a READ-ONLY or SINGLE USER database only. Make sure you have a
> current backup BEFORE you attempt it. Don't expect decent performance
> or reliability.
> Read:
> http://support.microsoft.com/defaul...kb;en-us;304261
> --
> David Portas, SQL Server MVP
> Whenever possible please post enough code to reproduce your problem.
> Including CREATE TABLE and INSERT statements usually helps.
> State what version of SQL Server you are using and specify the content
> of any error messages.
> SQL Server Books Online:
> http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
> --
>|||Banu_tr wrote:
> Dear David,
> I still got the message "Device Activation Error"
> any advice?
>
Are you sure the server has access to the share you are trying to use?
Same advice as before: don't do it. Not for production use anyway. Tell
your boss, customer or business owner that they need to purchase some
more storage.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--|||Banu_tr wrote:
> Dear David,
> I still got the message "Device Activation Error"
> any advice?
>
You need to check that the account that the SQL Server service runs
under can access the share where your data files are located. If SQL is
running under the service account then you need to change it to run as
a domain login, give that login the necessary permissions, then stop
and restart the SQL server service. Having done that, it should work
but as already indicated this is not a fully supported option and never
having tried it I don't know under what circumstances it might not work
at all.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--

Monday, March 19, 2012

Assist needed in creating a replication with sql 2005

I tried to create a local snapshot replication from data A to database
B for sql 2005. I followed the wizard and it was created successfully.
But,nothing written to the replication folder and the job failed.
I manually executed the sqls and it always failed on
sp_addpublication_snapshot and the error was:
'DB4\Administrator' is a member of sysadmin server role and cannot be
granted to or revoked from the proxy. Members of sysadmin server role
are allowed to use any proxy.
I log in to windows 2003 as administrator and the replication account
id dbsnap. What I have to do to avoid the error?
Is there a detailed step-by=step guide to create a snapshot
replication?
Can someone provide a set of sqls that I can just use to create a local
(or remote) snapshot?
Thanks,
Andy
The scripts are:
use [T2]
exec sp_replicationdboption @.dbname = N'T2', @.optname = N'publish',
@.value = N'true'
GO
-- Adding the snapshot publication
use [T2]
exec sp_addpublication @.publication = N'T2', @.description = N'Snapshot
publication of
database ''T2'' from Publisher ''DB4''.', @.sync_method = N'native',
@.retention = 0,
@.allow_push = N'true', @.allow_pull = N'true', @.allow_anonymous =
N'true',
@.enabled_for_internet = N'false', @.snapshot_in_defaultfolder = N'true',
@.compress_snapshot =
N'false', @.ftp_port = 21, @.ftp_login = N'anonymous',
@.allow_subscription_copy = N'false',
@.add_to_active_directory = N'false', @.repl_freq = N'snapshot', @.status
= N'active',
@.independent_agent = N'true', @.immediate_sync = N'true',
@.allow_sync_tran = N'false',
@.autogen_sync_procs = N'false', @.allow_queued_tran = N'false',
@.allow_dts = N'false',
@.replicate_ddl = 1
GO
exec sp_addpublication_snapshot @.publication = N'T2', @.frequency_type =
1,
@.frequency_interval = 0, @.frequency_relative_interval = 0,
@.frequency_recurrence_factor = 0,
@.frequency_subday = 0, @.frequency_subday_interval = 0,
@.active_start_time_of_day = 0,
@.active_end_time_of_day = 235959, @.active_start_date = 0,
@.active_end_date = 0, @.job_login =
N'db4\dbsnap', @.job_password = N'wenhua', @.publisher_security_mode = 0,
@.publisher_login =
N'sa', @.publisher_password = N'chang5911'
use [T2]
exec sp_addarticle @.publication = N'T2', @.article = N'RETURN_REASON',
@.source_owner =
N'dbo', @.source_object = N'RETURN_REASON', @.type = N'logbased',
@.description = null,
@.creation_script = null, @.pre_creation_cmd = N'drop', @.schema_option =
0x000000000803509D,
@.identityrangemanagementoption = N'manual', @.destination_table =
N'RETURN_REASON',
@.destination_owner = N'dbo', @.vertical_partition = N'false'
GO
Can you extract the code from the job and pass it to the snapshot.exe found
in c:\program files\Microsoft SQL Server\90\com?
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"AH" <hhhsu7a@.yahoo.com> wrote in message
news:1168824792.916342.291270@.11g2000cwr.googlegro ups.com...
>I tried to create a local snapshot replication from data A to database
> B for sql 2005. I followed the wizard and it was created successfully.
> But,nothing written to the replication folder and the job failed.
> I manually executed the sqls and it always failed on
> sp_addpublication_snapshot and the error was:
> 'DB4\Administrator' is a member of sysadmin server role and cannot be
> granted to or revoked from the proxy. Members of sysadmin server role
> are allowed to use any proxy.
>
> I log in to windows 2003 as administrator and the replication account
> id dbsnap. What I have to do to avoid the error?
>
> Is there a detailed step-by=step guide to create a snapshot
> replication?
>
> Can someone provide a set of sqls that I can just use to create a local
> (or remote) snapshot?
>
> Thanks,
> Andy
>
> The scripts are:
> use [T2]
> exec sp_replicationdboption @.dbname = N'T2', @.optname = N'publish',
> @.value = N'true'
> GO
> -- Adding the snapshot publication
> use [T2]
> exec sp_addpublication @.publication = N'T2', @.description = N'Snapshot
> publication of
>
> database ''T2'' from Publisher ''DB4''.', @.sync_method = N'native',
> @.retention = 0,
>
> @.allow_push = N'true', @.allow_pull = N'true', @.allow_anonymous =
> N'true',
>
> @.enabled_for_internet = N'false', @.snapshot_in_defaultfolder = N'true',
> @.compress_snapshot =
>
> N'false', @.ftp_port = 21, @.ftp_login = N'anonymous',
> @.allow_subscription_copy = N'false',
>
> @.add_to_active_directory = N'false', @.repl_freq = N'snapshot', @.status
> = N'active',
>
> @.independent_agent = N'true', @.immediate_sync = N'true',
> @.allow_sync_tran = N'false',
>
> @.autogen_sync_procs = N'false', @.allow_queued_tran = N'false',
> @.allow_dts = N'false',
>
> @.replicate_ddl = 1
> GO
>
> exec sp_addpublication_snapshot @.publication = N'T2', @.frequency_type =
> 1,
>
> @.frequency_interval = 0, @.frequency_relative_interval = 0,
> @.frequency_recurrence_factor = 0,
>
> @.frequency_subday = 0, @.frequency_subday_interval = 0,
> @.active_start_time_of_day = 0,
>
> @.active_end_time_of_day = 235959, @.active_start_date = 0,
> @.active_end_date = 0, @.job_login =
>
> N'db4\dbsnap', @.job_password = N'wenhua', @.publisher_security_mode = 0,
> @.publisher_login =
>
> N'sa', @.publisher_password = N'chang5911'
>
> use [T2]
> exec sp_addarticle @.publication = N'T2', @.article = N'RETURN_REASON',
> @.source_owner =
>
> N'dbo', @.source_object = N'RETURN_REASON', @.type = N'logbased',
> @.description = null,
>
> @.creation_script = null, @.pre_creation_cmd = N'drop', @.schema_option =
> 0x000000000803509D,
>
> @.identityrangemanagementoption = N'manual', @.destination_table =
> N'RETURN_REASON',
>
> @.destination_owner = N'dbo', @.vertical_partition = N'false'
> GO
>
|||Hilary,
I switched to use administor, instead of a windows user, and the
replication went fine. Does the windows user id require to have
administion privilege?
Andy
Hilary Cotter wrote:[vbcol=seagreen]
> Can you extract the code from the job and pass it to the snapshot.exe found
> in c:\program files\Microsoft SQL Server\90\com?
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
>
> "AH" <hhhsu7a@.yahoo.com> wrote in message
> news:1168824792.916342.291270@.11g2000cwr.googlegro ups.com...

Assist needed in creating a replication with sql 2005

I tried to create a local snapshot replication from data A to database
B for sql 2005. I followed the wizard and it was created successfully.
But,nothing written to the replication folder and the job failed.
I manually executed the sqls and it always failed on
sp_addpublication_snapshot and the error was:
'DB4\Administrator' is a member of sysadmin server role and cannot be
granted to or revoked from the proxy. Members of sysadmin server role
are allowed to use any proxy.
I log in to windows 2003 as administrator and the replication account
id dbsnap. What I have to do to avoid the error?
Is there a detailed step-by=step guide to create a snapshot
replication?
Can someone provide a set of sqls that I can just use to create a local
(or remote) snapshot?
Thanks,
Andy
The scripts are:
use [T2]
exec sp_replicationdboption @.dbname = N'T2', @.optname = N'publish',
@.value = N'true'
GO
-- Adding the snapshot publication
use [T2]
exec sp_addpublication @.publication = N'T2', @.description = N'Snapshot
publication of
database ''T2'' from Publisher ''DB4''.', @.sync_method = N'native',
@.retention = 0,
@.allow_push = N'true', @.allow_pull = N'true', @.allow_anonymous = N'true',
@.enabled_for_internet = N'false', @.snapshot_in_defaultfolder = N'true',
@.compress_snapshot =
N'false', @.ftp_port = 21, @.ftp_login = N'anonymous',
@.allow_subscription_copy = N'false',
@.add_to_active_directory = N'false', @.repl_freq = N'snapshot', @.status
= N'active',
@.independent_agent = N'true', @.immediate_sync = N'true',
@.allow_sync_tran = N'false',
@.autogen_sync_procs = N'false', @.allow_queued_tran = N'false',
@.allow_dts = N'false',
@.replicate_ddl = 1
GO
exec sp_addpublication_snapshot @.publication = N'T2', @.frequency_type =
1,
@.frequency_interval = 0, @.frequency_relative_interval = 0,
@.frequency_recurrence_factor = 0,
@.frequency_subday = 0, @.frequency_subday_interval = 0,
@.active_start_time_of_day = 0,
@.active_end_time_of_day = 235959, @.active_start_date = 0,
@.active_end_date = 0, @.job_login =
N'db4\dbsnap', @.job_password = N'wenhua', @.publisher_security_mode = 0,
@.publisher_login =
N'sa', @.publisher_password = N'chang5911'
use [T2]
exec sp_addarticle @.publication = N'T2', @.article = N'RETURN_REASON',
@.source_owner =
N'dbo', @.source_object = N'RETURN_REASON', @.type = N'logbased',
@.description = null,
@.creation_script = null, @.pre_creation_cmd = N'drop', @.schema_option = 0x000000000803509D,
@.identityrangemanagementoption = N'manual', @.destination_table = N'RETURN_REASON',
@.destination_owner = N'dbo', @.vertical_partition = N'false'
GOCan you extract the code from the job and pass it to the snapshot.exe found
in c:\program files\Microsoft SQL Server\90\com?
--
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"AH" <hhhsu7a@.yahoo.com> wrote in message
news:1168824792.916342.291270@.11g2000cwr.googlegroups.com...
>I tried to create a local snapshot replication from data A to database
> B for sql 2005. I followed the wizard and it was created successfully.
> But,nothing written to the replication folder and the job failed.
> I manually executed the sqls and it always failed on
> sp_addpublication_snapshot and the error was:
> 'DB4\Administrator' is a member of sysadmin server role and cannot be
> granted to or revoked from the proxy. Members of sysadmin server role
> are allowed to use any proxy.
>
> I log in to windows 2003 as administrator and the replication account
> id dbsnap. What I have to do to avoid the error?
>
> Is there a detailed step-by=step guide to create a snapshot
> replication?
>
> Can someone provide a set of sqls that I can just use to create a local
> (or remote) snapshot?
>
> Thanks,
> Andy
>
> The scripts are:
> use [T2]
> exec sp_replicationdboption @.dbname = N'T2', @.optname = N'publish',
> @.value = N'true'
> GO
> -- Adding the snapshot publication
> use [T2]
> exec sp_addpublication @.publication = N'T2', @.description = N'Snapshot
> publication of
>
> database ''T2'' from Publisher ''DB4''.', @.sync_method = N'native',
> @.retention = 0,
>
> @.allow_push = N'true', @.allow_pull = N'true', @.allow_anonymous => N'true',
>
> @.enabled_for_internet = N'false', @.snapshot_in_defaultfolder = N'true',
> @.compress_snapshot =>
> N'false', @.ftp_port = 21, @.ftp_login = N'anonymous',
> @.allow_subscription_copy = N'false',
>
> @.add_to_active_directory = N'false', @.repl_freq = N'snapshot', @.status
> = N'active',
>
> @.independent_agent = N'true', @.immediate_sync = N'true',
> @.allow_sync_tran = N'false',
>
> @.autogen_sync_procs = N'false', @.allow_queued_tran = N'false',
> @.allow_dts = N'false',
>
> @.replicate_ddl = 1
> GO
>
> exec sp_addpublication_snapshot @.publication = N'T2', @.frequency_type => 1,
>
> @.frequency_interval = 0, @.frequency_relative_interval = 0,
> @.frequency_recurrence_factor = 0,
>
> @.frequency_subday = 0, @.frequency_subday_interval = 0,
> @.active_start_time_of_day = 0,
>
> @.active_end_time_of_day = 235959, @.active_start_date = 0,
> @.active_end_date = 0, @.job_login =>
> N'db4\dbsnap', @.job_password = N'wenhua', @.publisher_security_mode = 0,
> @.publisher_login =>
> N'sa', @.publisher_password = N'chang5911'
>
> use [T2]
> exec sp_addarticle @.publication = N'T2', @.article = N'RETURN_REASON',
> @.source_owner =>
> N'dbo', @.source_object = N'RETURN_REASON', @.type = N'logbased',
> @.description = null,
>
> @.creation_script = null, @.pre_creation_cmd = N'drop', @.schema_option => 0x000000000803509D,
>
> @.identityrangemanagementoption = N'manual', @.destination_table => N'RETURN_REASON',
>
> @.destination_owner = N'dbo', @.vertical_partition = N'false'
> GO
>|||Hilary,
I switched to use administor, instead of a windows user, and the
replication went fine. Does the windows user id require to have
administion privilege?
Andy
Hilary Cotter wrote:
> Can you extract the code from the job and pass it to the snapshot.exe found
> in c:\program files\Microsoft SQL Server\90\com?
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
>
> "AH" <hhhsu7a@.yahoo.com> wrote in message
> news:1168824792.916342.291270@.11g2000cwr.googlegroups.com...
> >I tried to create a local snapshot replication from data A to database
> > B for sql 2005. I followed the wizard and it was created successfully.
> > But,nothing written to the replication folder and the job failed.
> >
> > I manually executed the sqls and it always failed on
> > sp_addpublication_snapshot and the error was:
> > 'DB4\Administrator' is a member of sysadmin server role and cannot be
> > granted to or revoked from the proxy. Members of sysadmin server role
> > are allowed to use any proxy.
> >
> >
> > I log in to windows 2003 as administrator and the replication account
> > id dbsnap. What I have to do to avoid the error?
> >
> >
> > Is there a detailed step-by=step guide to create a snapshot
> > replication?
> >
> >
> > Can someone provide a set of sqls that I can just use to create a local
> >
> > (or remote) snapshot?
> >
> >
> > Thanks,
> > Andy
> >
> >
> > The scripts are:
> > use [T2]
> > exec sp_replicationdboption @.dbname = N'T2', @.optname = N'publish',
> > @.value = N'true'
> > GO
> > -- Adding the snapshot publication
> > use [T2]
> > exec sp_addpublication @.publication = N'T2', @.description = N'Snapshot
> > publication of
> >
> >
> > database ''T2'' from Publisher ''DB4''.', @.sync_method = N'native',
> > @.retention = 0,
> >
> >
> > @.allow_push = N'true', @.allow_pull = N'true', @.allow_anonymous => > N'true',
> >
> >
> > @.enabled_for_internet = N'false', @.snapshot_in_defaultfolder = N'true',
> >
> > @.compress_snapshot => >
> >
> > N'false', @.ftp_port = 21, @.ftp_login = N'anonymous',
> > @.allow_subscription_copy = N'false',
> >
> >
> > @.add_to_active_directory = N'false', @.repl_freq = N'snapshot', @.status
> > = N'active',
> >
> >
> > @.independent_agent = N'true', @.immediate_sync = N'true',
> > @.allow_sync_tran = N'false',
> >
> >
> > @.autogen_sync_procs = N'false', @.allow_queued_tran = N'false',
> > @.allow_dts = N'false',
> >
> >
> > @.replicate_ddl = 1
> > GO
> >
> >
> > exec sp_addpublication_snapshot @.publication = N'T2', @.frequency_type => >
> > 1,
> >
> >
> > @.frequency_interval = 0, @.frequency_relative_interval = 0,
> > @.frequency_recurrence_factor = 0,
> >
> >
> > @.frequency_subday = 0, @.frequency_subday_interval = 0,
> > @.active_start_time_of_day = 0,
> >
> >
> > @.active_end_time_of_day = 235959, @.active_start_date = 0,
> > @.active_end_date = 0, @.job_login => >
> >
> > N'db4\dbsnap', @.job_password = N'wenhua', @.publisher_security_mode = 0,
> >
> > @.publisher_login => >
> >
> > N'sa', @.publisher_password = N'chang5911'
> >
> >
> > use [T2]
> > exec sp_addarticle @.publication = N'T2', @.article = N'RETURN_REASON',
> > @.source_owner => >
> >
> > N'dbo', @.source_object = N'RETURN_REASON', @.type = N'logbased',
> > @.description = null,
> >
> >
> > @.creation_script = null, @.pre_creation_cmd = N'drop', @.schema_option => > 0x000000000803509D,
> >
> >
> > @.identityrangemanagementoption = N'manual', @.destination_table => > N'RETURN_REASON',
> >
> >
> > @.destination_owner = N'dbo', @.vertical_partition = N'false'
> > GO
> >

Assist needed in creating a replication with sql 2005

I tried to create a local snapshot replication from data A to database
B for sql 2005. I followed the wizard and it was created successfully.
But,nothing written to the replication folder and the job failed.
I manually executed the sqls and it always failed on
sp_addpublication_snapshot and the error was:
'DB4\Administrator' is a member of sysadmin server role and cannot be
granted to or revoked from the proxy. Members of sysadmin server role
are allowed to use any proxy.
I log in to windows 2003 as administrator and the replication account
id dbsnap. What I have to do to avoid the error?
Is there a detailed step-by=step guide to create a snapshot
replication?
Can someone provide a set of sqls that I can just use to create a local
(or remote) snapshot?
Thanks,
Andy
The scripts are:
use [T2]
exec sp_replicationdboption @.dbname = N'T2', @.optname = N'publish',
@.value = N'true'
GO
-- Adding the snapshot publication
use [T2]
exec sp_addpublication @.publication = N'T2', @.description = N'Snapshot
publication of
database ''T2'' from Publisher ''DB4''.', @.sync_method = N'native',
@.retention = 0,
@.allow_push = N'true', @.allow_pull = N'true', @.allow_anonymous =
N'true',
@.enabled_for_internet = N'false', @.snapshot_in_defaultfolder = N'true',
@.compress_snapshot =
N'false', @.ftp_port = 21, @.ftp_login = N'anonymous',
@.allow_subscription_copy = N'false',
@.add_to_active_directory = N'false', @.repl_freq = N'snapshot', @.status
= N'active',
@.independent_agent = N'true', @.immediate_sync = N'true',
@.allow_sync_tran = N'false',
@.autogen_sync_procs = N'false', @.allow_queued_tran = N'false',
@.allow_dts = N'false',
@.replicate_ddl = 1
GO
exec sp_addpublication_snapshot @.publication = N'T2', @.frequency_type =
1,
@.frequency_interval = 0, @.frequency_relative_interval = 0,
@.frequency_recurrence_factor = 0,
@.frequency_subday = 0, @.frequency_subday_interval = 0,
@.active_start_time_of_day = 0,
@.active_end_time_of_day = 235959, @.active_start_date = 0,
@.active_end_date = 0, @.job_login =
N'db4\dbsnap', @.job_password = N'wenhua', @.publisher_security_mode = 0,
@.publisher_login =
N'sa', @.publisher_password = N'chang5911'
use [T2]
exec sp_addarticle @.publication = N'T2', @.article = N'RETURN_REASON',
@.source_owner =
N'dbo', @.source_object = N'RETURN_REASON', @.type = N'logbased',
@.description = null,
@.creation_script = null, @.pre_creation_cmd = N'drop', @.schema_option =
0x000000000803509D,
@.identityrangemanagementoption = N'manual', @.destination_table =
N'RETURN_REASON',
@.destination_owner = N'dbo', @.vertical_partition = N'false'
GOCan you extract the code from the job and pass it to the snapshot.exe found
in c:\program files\Microsoft SQL Server\90\com?
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"AH" <hhhsu7a@.yahoo.com> wrote in message
news:1168824792.916342.291270@.11g2000cwr.googlegroups.com...
>I tried to create a local snapshot replication from data A to database
> B for sql 2005. I followed the wizard and it was created successfully.
> But,nothing written to the replication folder and the job failed.
> I manually executed the sqls and it always failed on
> sp_addpublication_snapshot and the error was:
> 'DB4\Administrator' is a member of sysadmin server role and cannot be
> granted to or revoked from the proxy. Members of sysadmin server role
> are allowed to use any proxy.
>
> I log in to windows 2003 as administrator and the replication account
> id dbsnap. What I have to do to avoid the error?
>
> Is there a detailed step-by=step guide to create a snapshot
> replication?
>
> Can someone provide a set of sqls that I can just use to create a local
> (or remote) snapshot?
>
> Thanks,
> Andy
>
> The scripts are:
> use [T2]
> exec sp_replicationdboption @.dbname = N'T2', @.optname = N'publish',
> @.value = N'true'
> GO
> -- Adding the snapshot publication
> use [T2]
> exec sp_addpublication @.publication = N'T2', @.description = N'Snapshot
> publication of
>
> database ''T2'' from Publisher ''DB4''.', @.sync_method = N'native',
> @.retention = 0,
>
> @.allow_push = N'true', @.allow_pull = N'true', @.allow_anonymous =
> N'true',
>
> @.enabled_for_internet = N'false', @.snapshot_in_defaultfolder = N'true',
> @.compress_snapshot =
>
> N'false', @.ftp_port = 21, @.ftp_login = N'anonymous',
> @.allow_subscription_copy = N'false',
>
> @.add_to_active_directory = N'false', @.repl_freq = N'snapshot', @.status
> = N'active',
>
> @.independent_agent = N'true', @.immediate_sync = N'true',
> @.allow_sync_tran = N'false',
>
> @.autogen_sync_procs = N'false', @.allow_queued_tran = N'false',
> @.allow_dts = N'false',
>
> @.replicate_ddl = 1
> GO
>
> exec sp_addpublication_snapshot @.publication = N'T2', @.frequency_type =
> 1,
>
> @.frequency_interval = 0, @.frequency_relative_interval = 0,
> @.frequency_recurrence_factor = 0,
>
> @.frequency_subday = 0, @.frequency_subday_interval = 0,
> @.active_start_time_of_day = 0,
>
> @.active_end_time_of_day = 235959, @.active_start_date = 0,
> @.active_end_date = 0, @.job_login =
>
> N'db4\dbsnap', @.job_password = N'wenhua', @.publisher_security_mode = 0,
> @.publisher_login =
>
> N'sa', @.publisher_password = N'chang5911'
>
> use [T2]
> exec sp_addarticle @.publication = N'T2', @.article = N'RETURN_REASON',
> @.source_owner =
>
> N'dbo', @.source_object = N'RETURN_REASON', @.type = N'logbased',
> @.description = null,
>
> @.creation_script = null, @.pre_creation_cmd = N'drop', @.schema_option =
> 0x000000000803509D,
>
> @.identityrangemanagementoption = N'manual', @.destination_table =
> N'RETURN_REASON',
>
> @.destination_owner = N'dbo', @.vertical_partition = N'false'
> GO
>|||Hilary,
I switched to use administor, instead of a windows user, and the
replication went fine. Does the windows user id require to have
administion privilege?
Andy
Hilary Cotter wrote:[vbcol=seagreen]
> Can you extract the code from the job and pass it to the snapshot.exe foun
d
> in c:\program files\Microsoft SQL Server\90\com?
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
>
> "AH" <hhhsu7a@.yahoo.com> wrote in message
> news:1168824792.916342.291270@.11g2000cwr.googlegroups.com...

Sunday, March 11, 2012

assigning Select results to local vars in SP

Hi. I'd like to assign the results of a select statement to a local
variables in my stored procedure. My intent is something like this:
SELECT TOP 1 field1,field2,field3 FROM table WHERE field1 = @.InParam
only, some how I'd like to get the field2,field3 into variables. Can
this be done?
Thanks in advanceFirst of all, do not use TOP without using ORDER BY, unless selecting
somewhat random results is required (which I gues is not).
Other than that, this is the way to go:
select @.variable_name = owner.table.colum
from owner.table
where (owner.table.another_column = @.parameter)
Don't forget to look up using local variables in Books Online.
ML|||Johnny,
Something like this:
USE Pubs
GO
CREATE PROC TESTPROC
@.AID varchar(11)
AS
DECLARE @.FName varchar(30)
DECLARE @.LName varchar(30)
SELECT @.FName = au_fname, @.LName = au_lname
FROM authors
WHERE au_id = @.AID
PRINT @.FName + ' ' + @.LName
GO
EXEC TESTPROC '172-32-1176'
HTH
Jerry
"Johnny Ruin" <schafer.dave@.gmail.com> wrote in message
news:1127950731.353336.297780@.g43g2000cwa.googlegroups.com...
> Hi. I'd like to assign the results of a select statement to a local
> variables in my stored procedure. My intent is something like this:
> SELECT TOP 1 field1,field2,field3 FROM table WHERE field1 = @.InParam
> only, some how I'd like to get the field2,field3 into variables. Can
> this be done?
> Thanks in advance
>|||Thanks Jerry, I'll try this out!|||Just be careful! If the SELECT returns more than 1 rows, you will *not* get
an error. The
variable(s) will contain the value for an unspecified row.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Johnny Ruin" <schafer.dave@.gmail.com> wrote in message
news:1127953579.251983.177820@.o13g2000cwo.googlegroups.com...
> Thanks Jerry, I'll try this out!
>

Thursday, March 8, 2012

Assigning 1-row & multi-column query result to local variable

Hello,
I am just new to T-SQL programming on SQL server 2000. I would like to
ask you if it is possible (like in VBA for example) to save the result
of query (1 row, but multi columns) to some "array" or "object"
variable in order to reference the concrete components (fields) of
this variable in the future code.
For example in VBA:
Dim query1 as Recordset
Set query1 = CurrentDb.OpenRecordset("ABC")
MsgBox query1!ID
MsgBox query1!Comment
Or is the only way to save the results to the temp table and use other
queries to select the required fields? This means more rows of code
and slowing of the whole calculation process.
Thank you very much for your answer.
MilanMilan,
What are you trying to accomplish?
AMB
"Milan" wrote:

> Hello,
> I am just new to T-SQL programming on SQL server 2000. I would like to
> ask you if it is possible (like in VBA for example) to save the result
> of query (1 row, but multi columns) to some "array" or "object"
> variable in order to reference the concrete components (fields) of
> this variable in the future code.
> For example in VBA:
> Dim query1 as Recordset
> Set query1 = CurrentDb.OpenRecordset("ABC")
> MsgBox query1!ID
> MsgBox query1!Comment
>
> Or is the only way to save the results to the temp table and use other
> queries to select the required fields? This means more rows of code
> and slowing of the whole calculation process.
> Thank you very much for your answer.
> Milan
>|||No arrays in SQL but you could do something like this:
select @.var1 = col1, @.var2 = col2 ... from tableName where IDcol = ...
The query must return just 1 row though for this to work. If I remember
correctly, if it returns more then 1 row, then the variables will receive
the values of the last row.
Maybe if you described what you are trying to do, then someone could find a
better solution.
"Milan" <milan_vaclavik@.centrum.cz> wrote in message
news:b4cdce36.0503090705.1f5d824e@.posting.google.com...
> Hello,
> I am just new to T-SQL programming on SQL server 2000. I would like to
> ask you if it is possible (like in VBA for example) to save the result
> of query (1 row, but multi columns) to some "array" or "object"
> variable in order to reference the concrete components (fields) of
> this variable in the future code.
> For example in VBA:
> Dim query1 as Recordset
> Set query1 = CurrentDb.OpenRecordset("ABC")
> MsgBox query1!ID
> MsgBox query1!Comment
>
> Or is the only way to save the results to the temp table and use other
> queries to select the required fields? This means more rows of code
> and slowing of the whole calculation process.
> Thank you very much for your answer.
> Milan|||SQL is a declarative language not a procedural one like VB. Storing
values from rows to variables is something you should generally try to
avoid. Instead of retrieving values and then referencing them in future
code, aim to write declarative, set-based code that operates on the
whole set of data at once. Your SQL code will be much cleaner, more
efficient and more maintainable that way. Don't try to use TSQL like it
was VB.
It is in fact possible to assign column values to variables, using a
SET or SELECT statement but variable assignment should be the exception
rather than the rule. Frequent use of variable assignment from tables
implies that you'll be using cursor based processing - a common error
made by programmers new to SQL. If you have an actual problem (the code
you posted already doesn't do anything useful that can't be achieved
with a SELECT statement) then please come back with more information so
that we can suggest an alternative.
David Portas
SQL Server MVP
--|||I would like to thank you for your replies.
I have the table with columns named like "A_01", "A_02", ..., "A_30",
"B_01", "B_02", ..., "B_30", "C_01" etc. I know it is badly designed but
I inherited it from my colleague. I have created a complex (and slow)
query which returns 1 row from this table. What I have to do now
(separately for A, B, C...) is to insert some calculated values (based
on concrete values of 01, 02,..., 30) to some other tables. For example
if A_01 = 6, I have to input A_02/6 to the A_03th, (A_03+1)th, ...,
(A_03+5)th column of some concrete table. The calculation is really very
complex.
In VBA this is a trivial task but i can not manage it easily in T-SQL.
Thank you for your ideas!
Milan
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!|||Hello Milan,
If it's easy for you to do in VBA, then why not do it in VBA? What requirem
ent
is there that you must do this in T-SQL?
Craig

> I would like to thank you for your replies.
> I have the table with columns named like "A_01", "A_02", ..., "A_30",
> "B_01", "B_02", ..., "B_30", "C_01" etc. I know it is badly designed
> but I inherited it from my colleague. I have created a complex (and
> slow) query which returns 1 row from this table. What I have to do now
> (separately for A, B, C...) is to insert some calculated values (based
> on concrete values of 01, 02,..., 30) to some other tables. For
> example if A_01 = 6, I have to input A_02/6 to the A_03th, (A_03+1)th,
> ..., (A_03+5)th column of some concrete table. The calculation is
> really very complex.
> In VBA this is a trivial task but i can not manage it easily in T-SQL.
> Thank you for your ideas!
> Milan
> *** Sent via Developersdex http://www.examnotes.net *** Don't just
> participate in USENET...get rewarded for it!
>|||I think you've realised that the root of your problem is the poor
design. I'm not sure why you would perpetuate this by creating another
table rather than do it in a view or query but anyway you may be able
to use something like this:
INSERT INTO Garbage_Out (a_01, a_o2, a_03)
SELECT I.a_01, NULL, I.a_02/I.a_01,
CASE I.a_01
WHEN 1 THEN I.a_0?
WHEN 2 THEN I.a_0?
..
END,
CASE I.a_01
WHEN 1 THEN I.a_0?
WHEN 2 THEN I.a_0?
..
END
FROM Garbage_In AS I
Fill in the question marks yourself - I wasn't clear from your
narrative which columns you would want to refer to. This "design" is
probably beyond redemption. Tables are not arrays.
David Portas
SQL Server MVP
--|||Hello Milan,

> In VBA this is a trivial task but i can not manage it easily in T-SQL.
Why not do it in VBA, then? What requirement is there that you do it in
T-SQL?
Craig

Friday, February 24, 2012

ASPNETDB.mdf "...already in use..." Error and Broader Questions

When you create and host an ASP.Net 2.0 site on your local computer and then configure .Net 2.0's drop-in user registration and management system it creates a SQL file named ASPNETDB.mdf with a whole bunch of tables and stored procedures (…as most of you know). If you add your own custom tables to that database file and then try to call those tables you get an error that says that ASPNETDB.mdf is already in use. One way to get around this is to create a separate database in the form of another ".mdf" file and then put all of your own custom tables in it. You avoid the "...already in use..." errors that way but all your user accounts and the primary key structure that identifies them are in the original ASPNETDB.mdf file. This makes it impossible to do primary/foreign key relationships between those tables and those in the new separate database you created. It's kind of a catch-22 situation...unless I'm missing something that relates to releasing the ASPNETDB.mdf file from use whenever it is called so that additional tables and queries against that database file can be made without the "…already in use…" error cropping up. I am wondering if this problem is because the ASPNETDB.mdf file is not a "real" SQL database and as such imposes multiple-connectivity limitations such as those I am seeing. If this is true, migrating to a real SQL database would alleviate this? Finally, from a broader security and scalability standpoint…what are the best practices relating to use of the ASPNETDB.mdf database for all your custom tables? Should an additional database be created for all my application's custom tables (leading to the primary/foreign key problems) or should the additional tables be put into the ASPNETDB.mdf file (with some way of working around the "…already in use…" error)? A long-winded and broad question…thanks in advance for any responses.

MDCragg

The default membership provider already has an open connection to the file, which seems like the reason why you can't make your own connection. Perhaps you could extend this provider to keep its current functionality, but add your own requirements to access the other tables, as well. The default provider is the System.Web.Security.SqlMembershipProvider class. After you create this, set it as the default provider in your web.config.

Sample on how to configure a membership provider in web.config:http://msdn2.microsoft.com/en-us/library/44w5aswa.aspx

|||

That article tells how to merge the membership provider tables and stored procedures into my own database. I will try this to see if it solves the problem. I am at least a little bit doubtful if it will though because it seems like it will just shift the same persistent and exclusive connectivity problem I am having from the current user account database to my own database.

|||

This seems to have worked. I installed SQL Server Management Studio Express. I wasn't able to navigate to the existing custom database that I had created so I copied it to the default directory that SQL Server MSE utilizes. I was able to connect to it there and thus "attach" it to my PC's SQL host. Once that was done I was able to use the aspnet_regsql.exe utility to populate that database with all of .Net's Membership tables, views, stored procedures, etc. I copied the database back to the App_Data folder. I adjusted all the Membership entries in the web.config folder to "point to" the custom database instead of the ASPNETDB.mdf file (which I removed). I did some additional tweaking with things such as connection strings. Then I launched the site and everything seemed to work. I am able to connect to the .Net Membership tables as well as all my own tables...all of which exist in the one custom database file.

So, this is fixed although I don't know what the difference was between the ASPNETDB.mdf file and the custom ".mdf" file that I created. I'm sure there is a setting or two somewhere in the database instance, the connection, or something or other that led to the difficulty.

ASPNETDB replaces my database in connection

Hi,
I've a little problem. When I connect my local server by this connection string:Data Source=NB126\SQLEXPRESS;Initial Catalog=TVRM;Integrated Security=TrueI get content of ASPNETDB.MDF (placed in App_Data directory) instead content of my own database named TVRM. Please help...

Hi ciTrus,

Are you sure your connection string is actually used when connecting to database?(a small trick here is that, assign a wrong server name which doesnot exist to your connection string and test again. see if your data still can be populated).

Rember that there is a default "AspNetSqlMembershipProvider" in you machine.config and if you are using sql express, this provider will direct your membership database to App_Data folder silently (which i think is the case you are currently in). If you want to use a custom membership database, you need to add a new membership provider and put it to your web.config.

like: <system.web>
<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="20">
<providers>
<remove name="AspNetSqlProvider" />
<add name="SqlProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName=HERE IS YOUR CONNECTION STRING NAME
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
passwordFormat="Hashed"
applicationName="/" />
</providers>
</membership>
</system.web>

Hope my suggestion helps

|||

Bo Chen,
thank you very much. I did exactly what you wrote and it worked.Big Smile

CiTrus

aspnetdb on host, connection string

Hi

I am having trouble connecting to aspnetdb on the shared host. On my local server this is my connection string which works fine:

<addname="MyLocalSqlServer"connectionString="Data Source=.\SQLExpress;Integrated Security=SSPI;Initial Catalog=aspnetdb;User Instance=false"

providerName="System.Data.SqlClient" />

But, this doesn't work on the host (just putting in host address):

<addname="MyLocalSqlServer"connectionString="190.40...232,1444;Integrated Security=SSPI;Initial Catalog=aspnetdb_booksale;User Instance=false"

providerName="System.Data.SqlClient" />,

and I get the error :

Login failed for user ''. The user is not associated with a trusted SQL Server connection.

so I put in the user id and password that i used when I created the aspnetdb_booksale db

<addname="MyLocalSqlServer"connectionString="Data Source=196...232,1444;Integrated Security=False;User ID=aspnetdbbooksale; password=amanda;Initial Catalog=aspnetdb_booksale;User Instance=false"

providerName="System.Data.SqlClient" />

and I get the error:

The ConnectionString property has not been initialized.

Any ideas for me?

Amanda

Hi

My problem is not the connection string, because the one below works when I use the add user wizard. However, I get the error when I use the "createuser.membership" method. Funny tho it worked on my local server...

<addname="MyLocalSqlServer"connectionString="Data Source=196...232,1444;Integrated Security=False;User ID=aspnetdbbooksale; password=amanda;Initial Catalog=aspnetdb_booksale;User Instance=false"

|||

So you mean you got the "The ConnectionString property has not been initialized" when you connect from remote machine using the connection string below?

addname="MyLocalSqlServer"connectionString="Data Source=196...232,1444;Integrated Security=False;User ID=aspnetdbbooksale; password=amanda;Initial Catalog=aspnetdb_booksale;User Instance=false"

Really strange. Every time you got the same error message?

aspnetdb is on a "network path that is not supported for database files"

I have two, probably related, problems:

I have a very simple site. It will be used on the local intranet only. I want to use the windows authentication so users do not have to log on. The aspnetdb has been created using the configuration tool. If I use Server Explorer in vs to work on the site on my local machine, I can open aspnetdb, look at its tables, etc. If I use Server Explorer in vs to work on the site on the server, aspnetdb will not open and gives this error message:

..."network path that is not supported for database files"...

Other sites on the same server give the same message, but the sites work. I think this is because they can read the file but not write it; but that is a guess. We have tried everything; my head is ready to explode. We are using SQLServerExpress. It resides on the server's C drive (as does our data database). The web site, and hence the aspnetdb are on the F: drive of the same machine. Does SQLServerExpress treat the F: drive as a UNC drive? If so, are we in deep doo doo? I'm at a loss.

As far as logging in: If I debug from vs, the login works beautifully both on my local machine and running from the server using vs. Login does not work when accessing the site from iexplorer. Mystified by that one, too. I tried to implement profiles and they crash, too; that led me to consider a write problem.

Don't know what to do; any help is appreciated.

This is a common connection exception, which may be misleading in some cases. You may take a look at this article:

http://www.aspspider.net/resources/Resource170.aspx

aspnet_regiis on remote system

Sure, the subject line seems easy enough. But is there a way that I can run this tool against my local SQL 2k5 server and script out the objects it creates to try and set up the tables and what-not on a remote server that doesn't accept remote connections? Or is there maybe a pre-built script somewhere that you can point me to?

I've tried to grab the stored procs and tables under the aspnet schema and script them out but it's not working correctly. Still can't run my login form against it.

Thanks

Hello,

I think you mean aspnet_regsql.exe? If you run it on your own computer like this: aspnet_regsql.exe /? you will see all available options. In it you will read that it's possible to generate an SQL script file. You can then use this script file to create the tables.

|||

Yes, I did mean the aspnet_regsql.exe. I gen'ed the script. THanks...

ASPNET worker process account can't login to Database

Hi,
I'm using .Net Remoting and IIS (5.1) to pull data from a (local for now)
SQL Server 2005 database. My application is failing at the point at which a
connection to the database is being opened.
Using cn as New SqlConnection(ConnectString)
cn.Open()
Causes an SQLException to be thrown. The message is...
Cannot open database "AppData" requested by the login. The login failed.
"Login failed for user '<MachineName>\ASPNET'
This is the ASP.Net worker process user. I have had some problems with this
User Id on this machine - it was originally absent from the machine. I got
it back by re-installing ASP.Net (ver 2.0). Now all my remoting stuff is
working, but I cannot get to the data.
So my question is, what configuration items / permissions in SQL Server
should I set up to give the ASPNet worker process access to my data?.
For now the application, SQL Server Instance, and IIS are all on the same
machine. Everything seems to work except for the login call to the Database
.
Thanks for your help.
BBMHello BBM,
You could add the <Machine Name>\ASPNET user in the SQL Login. After that,
you could grant the proper permission for the account to access the sql
database.
Here is an article you could refer:
Building Secure ASP.NET Applications: Authentication, Authorization, and
Secure Communication
http://msdn2.microsoft.com/en-us/library/aa302387.aspx
Sincerely,
Wei Lu
Microsoft Online Community Support
========================================
==========
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscript...ault.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscript...t/default.aspx.
========================================
==========
(This posting is provided "AS IS", with no warranties, and confers no
rights.)|||Hi Wei Lu,
Thanks for your help. I knew this had to be covered someplace.
BTW, Searching Help in SQL Server, or in Visual Studio on this topic, the
ASP "worker process" account, returns nothing remotely useful.
Thanks again.
BBM
"Wei Lu [MSFT]" wrote:

> Hello BBM,
> You could add the <Machine Name>\ASPNET user in the SQL Login. After that,
> you could grant the proper permission for the account to access the sql
> database.
> Here is an article you could refer:
> Building Secure ASP.NET Applications: Authentication, Authorization, and
> Secure Communication
> http://msdn2.microsoft.com/en-us/library/aa302387.aspx
> Sincerely,
> Wei Lu
> Microsoft Online Community Support
> ========================================
==========
> Get notification to my posts through email? Please refer to
> l]
> ications.
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> [url]http://msdn.microsoft.com/subscriptions/support/default.aspx." target="_blank">http://msdn.microsoft.com/subscript...t/default.aspx.
> ========================================
==========
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>|||Hello BBM,
You could use the MSDN search in the web directly. And you could search for
ASPNET and SQL Server as the key words.
Thanks!
Sincerely,
Wei Lu
Microsoft Online Community Support
========================================
==========
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscript...ault.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscript...t/default.aspx.
========================================
==========
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Monday, February 13, 2012

ASP.NET ReportViewer / Non-String parameters

I am displaying a local report in a ReportViewer control on an asp.net web page. My report contains non-string parameters. How can i set a non-string parameter value on a local report?You will need to call .ToString() on your value to set it on ReportParameter.|||That would result in a string being passed to the report. I want to pass a float or a datetime to the report.

The only way i've been able to get this to work is to create a typed dataset with the "parameters" i want sent and then use aggregation functions (first,sum, etc...) to get to the data into the report. That is a big workaround in order to get a few simple floats and times into my report. Has anyone been able to get this done using another method?
|||If the data type of the parameter is set to integer/float, you can do these operations. And you can always convert between types in a report expression.

Sunday, February 12, 2012

ASP.NET and SQL Server

Hello.
I have an asp.net application which currently connects to a local instance
of sql server without any issue.
When I connect to a remote sql server (same database and userid and password
are valid) there is an error indicating 'access denied.' But, when the same
code and connection strings are run on the remote server (along with the
database) the application works fine.
Connection String
user id=UserName;password=password,data source=datasource;initial
catalog=dbName
datasource\ASPNET has been added to the sql server as a user.
Any ideas? I'm using SQL Authentication and ASP.NET 1.1
Does ASP.NET run under another account when accessing a remote server?
Thanks.a) look up SetSpn
b) look up 'trust for delegation'
I bitched up a storm about this at microsoft; they don't publish this
information anywhere.
it pissed me off sooooo bad.
it's like some secret squirrel functionality in Active Directory.
-Aaron
mojo wrote:
> Hello.
> I have an asp.net application which currently connects to a local instance
> of sql server without any issue.
> When I connect to a remote sql server (same database and userid and passwo
rd
> are valid) there is an error indicating 'access denied.' But, when the sam
e
> code and connection strings are run on the remote server (along with the
> database) the application works fine.
> Connection String
> user id=UserName;password=password,data source=datasource;initial
> catalog=dbName
> datasource\ASPNET has been added to the sql server as a user.
> Any ideas? I'm using SQL Authentication and ASP.NET 1.1
> Does ASP.NET run under another account when accessing a remote server?
> Thanks.|||Since you use Username/Password pair (meaning the SQL Server's
authentication mode is mixed mode), it does not matter if you add
MachineName\ASPNET user account as a login/user to the SQL Server/database.
The other posted reply also make no sense to your problem.
Which version of QL Server do you use? SQL Server2000 or 2005? I'd look into
two things:
1. Is remote access to the SQL Server enabled? by default installation
(especially if it is SQL Server2005/Express), remote access is disabled. You
nned to explicitly enable remote access to it;
2. Double-check to make sure the SQL Server's authentication mode is mixed
mode. Again. by default installation, SQL Server uses Windows Authentication
mode (If your app indeed worked on the same computer as the SQL Server, with
the given user name and password in connectionString, then you do not need
make this check, unless the remote SQL Server is not the same SQL Server you
have tested on the same computer).
"mojo" <mojo@.discussions.microsoft.com> wrote in message
news:52A09F8F-BC9B-4DFE-B004-3D406F0B5760@.microsoft.com...
> Hello.
> I have an asp.net application which currently connects to a local instance
> of sql server without any issue.
> When I connect to a remote sql server (same database and userid and
> password
> are valid) there is an error indicating 'access denied.' But, when the
> same
> code and connection strings are run on the remote server (along with the
> database) the application works fine.
> Connection String
> user id=UserName;password=password,data source=datasource;initial
> catalog=dbName
> datasource\ASPNET has been added to the sql server as a user.
> Any ideas? I'm using SQL Authentication and ASP.NET 1.1
> Does ASP.NET run under another account when accessing a remote server?
> Thanks.
>|||Hello,
Yes, I did double check that and it is in mixed mode. I'm running SQL Server
2000 on Windows XP & ASP.NET 1.1.
Regarding remote access, where is that in SQL 2000? I don't believe I've ran
into that setting before. Do you mind pointing me in the direction of where
I
can find it?
Thanks
"Norman Yuan" wrote:

> Since you use Username/Password pair (meaning the SQL Server's
> authentication mode is mixed mode), it does not matter if you add
> MachineName\ASPNET user account as a login/user to the SQL Server/database
.
> The other posted reply also make no sense to your problem.
> Which version of QL Server do you use? SQL Server2000 or 2005? I'd look in
to
> two things:
> 1. Is remote access to the SQL Server enabled? by default installation
> (especially if it is SQL Server2005/Express), remote access is disabled. Y
ou
> nned to explicitly enable remote access to it;
> 2. Double-check to make sure the SQL Server's authentication mode is mixed
> mode. Again. by default installation, SQL Server uses Windows Authenticati
on
> mode (If your app indeed worked on the same computer as the SQL Server, wi
th
> the given user name and password in connectionString, then you do not need
> make this check, unless the remote SQL Server is not the same SQL Server y
ou
> have tested on the same computer).
> "mojo" <mojo@.discussions.microsoft.com> wrote in message
> news:52A09F8F-BC9B-4DFE-B004-3D406F0B5760@.microsoft.com...
>
>|||check
sp_configure sysytem stored procedure.
I think it might require a restart for the changes to take effect.
-Omnibuzz (The SQL GC)
http://omnibuzz-sql.blogspot.com/|||ok, I checked Remote Access and it was already set to true.
Any ideas if this issue is related to version of install (Personal v
Standard v Enterprise Edition)?
"Omnibuzz" wrote:

> check
> sp_configure sysytem stored procedure.
> I think it might require a restart for the changes to take effect.
> -Omnibuzz (The SQL GC)
> http://omnibuzz-sql.blogspot.com/
>|||Can you connect to the said SQL Server from other computers at all (you can
try to access the SQL Server from other computer by creating ODBC data
source on these computers, or create a data link file (blank text file with
extension *.udl).
If you can, then it is the problem of your ASP.NET app (assume the network
cable/hub... hardware are OK. Have you checked them?), if you cannot, it is
the problem of the SQL Server configuration.
"mojo" <mojo@.discussions.microsoft.com> wrote in message
news:D4B879EE-7CBE-4A7F-B0AD-C10DDE16685D@.microsoft.com...
> Hello,
> Yes, I did double check that and it is in mixed mode. I'm running SQL
> Server
> 2000 on Windows XP & ASP.NET 1.1.
> Regarding remote access, where is that in SQL 2000? I don't believe I've
> ran
> into that setting before. Do you mind pointing me in the direction of
> where I
> can find it?
> Thanks
> "Norman Yuan" wrote:
>

Thursday, February 9, 2012

ASP.NET 2.0 and SQL Server 2000 connection issue

Hi,
I am developing an ASP.NET 2.0 application and SQL Server 2000 as
back-end. The connection to DB works fine if I connect to my local or
our dev databases. It is giving me the error when I try to connect to
Test database. However, I am able to connect to the same database
through Enterprise Manager by using same credentials. I tried using
TCP/IP and named pipe connections.
I am using the following connection string.
Password=password;Persist Security Info=True;User ID=User;Initial
Catalog=db;Data Source=server\instance;Network Library=DBMSSOCN;"
I am getting the following errors.
When using TCP/IP connection:
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: TCP Provider, error: 0 - No connection could be
made because the target machine actively refused it.)
When using Named Pipes:
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 a connection to SQL Server)
Any help is appreciated.
Thanks,
SreedharIs this a 2000 instance with a SQL server 2005 instance running as well?
A SQL 2000 with .net connection should look like...
Standard Security:
"Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;User
Id=sa;Password=asdasd;"
a.. Trusted Connection:
"Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;Integrated
Security=SSPI;"
You might have some issues if you are running different instances so let me
know...
thanks,
/*
Warren Brunk - MCITP - SQL 2005, MCDBA
www.techintsolutions.com
*/
<sreedhardasi@.gmail.com> wrote in message
news:1158682323.098370.14170@.k70g2000cwa.googlegroups.com...
> Hi,
> I am developing an ASP.NET 2.0 application and SQL Server 2000 as
> back-end. The connection to DB works fine if I connect to my local or
> our dev databases. It is giving me the error when I try to connect to
> Test database. However, I am able to connect to the same database
> through Enterprise Manager by using same credentials. I tried using
> TCP/IP and named pipe connections.
> I am using the following connection string.
> Password=password;Persist Security Info=True;User ID=User;Initial
> Catalog=db;Data Source=server\instance;Network Library=DBMSSOCN;"
> I am getting the following errors.
> When using TCP/IP connection:
> 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: TCP Provider, error: 0 - No connection could be
> made because the target machine actively refused it.)
> When using Named Pipes:
> 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 a connection to SQL Server)
>
> Any help is appreciated.
> Thanks,
> Sreedhar
>|||No, only SQL Server 2000 is running on the server, but it has several
instances. I am using one of them.
I verified my connection string and it is similar to the string that
you provided, except that it has SQL server instance for Data Source.
Let me know if I can provide any additional information.
Thanks,
Sreedhar
Warren Brunk wrote:[vbcol=seagreen]
> Is this a 2000 instance with a SQL server 2005 instance running as well?
> A SQL 2000 with .net connection should look like...
> Standard Security:
> "Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;User
> Id=sa;Password=asdasd;"
> a.. Trusted Connection:
> "Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;Integrated
> Security=SSPI;"
> You might have some issues if you are running different instances so let m
e
> know...
> thanks,
> --
> /*
> Warren Brunk - MCITP - SQL 2005, MCDBA
> www.techintsolutions.com
> */
>
> <sreedhardasi@.gmail.com> wrote in message
> news:1158682323.098370.14170@.k70g2000cwa.googlegroups.com...|||Hopefully, it doesn't look like this: "Data Source=server\instance" because
that wouldn't work.
I noticed that was the connection string you originally submitted.
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
<sreedhardasi@.gmail.com> wrote in message
news:1158695873.697272.313370@.i42g2000cwa.googlegroups.com...
> No, only SQL Server 2000 is running on the server, but it has several
> instances. I am using one of them.
> I verified my connection string and it is similar to the string that
> you provided, except that it has SQL server instance for Data Source.
> Let me know if I can provide any additional information.
> Thanks,
> Sreedhar
> Warren Brunk wrote:
>|||Thanks for your reply. Then, what would be the correct format?
Arnie Rowland wrote:[vbcol=seagreen]
> Hopefully, it doesn't look like this: "Data Source=server\instance" becaus
e
> that wouldn't work.
> I noticed that was the connection string you originally submitted.
> --
> Arnie Rowland, Ph.D.
> Westwood Consulting, Inc
> Most good judgment comes from experience.
> Most experience comes from bad judgment.
> - Anonymous
>
> <sreedhardasi@.gmail.com> wrote in message
> news:1158695873.697272.313370@.i42g2000cwa.googlegroups.com...|||Replace the word 'server' with the actual name of your server, and the word
'instance' with the actual instance name of your SQL Server instance. If you
don't have a 'named' instance, then leave the slash and instance name off.
For example: "Data Source=MyComputer", or "Data Source=MyComputer\MSDE"

Each 'instance' is a separate SQL Server.
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
<sreedhardasi@.gmail.com> wrote in message
news:1158698297.475884.293360@.k70g2000cwa.googlegroups.com...[vbcol=seagreen]
> Thanks for your reply. Then, what would be the correct format?
> Arnie Rowland wrote:
>

ASP.NET 2.0 and SQL Server 2000 connection issue

Hi,
I am developing an ASP.NET 2.0 application and SQL Server 2000 as
back-end. The connection to DB works fine if I connect to my local or
our dev databases. It is giving me the error when I try to connect to
Test database. However, I am able to connect to the same database
through Enterprise Manager by using same credentials. I tried using
TCP/IP and named pipe connections.
I am using the following connection string.
Password=password;Persist Security Info=True;User ID=User;Initial
Catalog=db;Data Source=server\instance;Network Library=DBMSSOCN;"
I am getting the following errors.
When using TCP/IP connection:
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: TCP Provider, error: 0 - No connection could be
made because the target machine actively refused it.)
When using Named Pipes:
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 a connection to SQL Server)
Any help is appreciated.
Thanks,
Sreedhar
Is this a 2000 instance with a SQL server 2005 instance running as well?
A SQL 2000 with .net connection should look like...
Standard Security:
"Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;User
Id=sa;Password=asdasd;"
a.. Trusted Connection:
"Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;Integrated
Security=SSPI;"
You might have some issues if you are running different instances so let me
know...
thanks,
/*
Warren Brunk - MCITP - SQL 2005, MCDBA
www.techintsolutions.com
*/
<sreedhardasi@.gmail.com> wrote in message
news:1158682323.098370.14170@.k70g2000cwa.googlegro ups.com...
> Hi,
> I am developing an ASP.NET 2.0 application and SQL Server 2000 as
> back-end. The connection to DB works fine if I connect to my local or
> our dev databases. It is giving me the error when I try to connect to
> Test database. However, I am able to connect to the same database
> through Enterprise Manager by using same credentials. I tried using
> TCP/IP and named pipe connections.
> I am using the following connection string.
> Password=password;Persist Security Info=True;User ID=User;Initial
> Catalog=db;Data Source=server\instance;Network Library=DBMSSOCN;"
> I am getting the following errors.
> When using TCP/IP connection:
> 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: TCP Provider, error: 0 - No connection could be
> made because the target machine actively refused it.)
> When using Named Pipes:
> 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 a connection to SQL Server)
>
> Any help is appreciated.
> Thanks,
> Sreedhar
>
|||No, only SQL Server 2000 is running on the server, but it has several
instances. I am using one of them.
I verified my connection string and it is similar to the string that
you provided, except that it has SQL server instance for Data Source.
Let me know if I can provide any additional information.
Thanks,
Sreedhar
Warren Brunk wrote:[vbcol=seagreen]
> Is this a 2000 instance with a SQL server 2005 instance running as well?
> A SQL 2000 with .net connection should look like...
> Standard Security:
> "Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;User
> Id=sa;Password=asdasd;"
> a.. Trusted Connection:
> "Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;Integrated
> Security=SSPI;"
> You might have some issues if you are running different instances so let me
> know...
> thanks,
> --
> /*
> Warren Brunk - MCITP - SQL 2005, MCDBA
> www.techintsolutions.com
> */
>
> <sreedhardasi@.gmail.com> wrote in message
> news:1158682323.098370.14170@.k70g2000cwa.googlegro ups.com...
|||Hopefully, it doesn't look like this: "Data Source=server\instance" because
that wouldn't work.
I noticed that was the connection string you originally submitted.
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
<sreedhardasi@.gmail.com> wrote in message
news:1158695873.697272.313370@.i42g2000cwa.googlegr oups.com...
> No, only SQL Server 2000 is running on the server, but it has several
> instances. I am using one of them.
> I verified my connection string and it is similar to the string that
> you provided, except that it has SQL server instance for Data Source.
> Let me know if I can provide any additional information.
> Thanks,
> Sreedhar
> Warren Brunk wrote:
>
|||Thanks for your reply. Then, what would be the correct format?
Arnie Rowland wrote:[vbcol=seagreen]
> Hopefully, it doesn't look like this: "Data Source=server\instance" because
> that wouldn't work.
> I noticed that was the connection string you originally submitted.
> --
> Arnie Rowland, Ph.D.
> Westwood Consulting, Inc
> Most good judgment comes from experience.
> Most experience comes from bad judgment.
> - Anonymous
>
> <sreedhardasi@.gmail.com> wrote in message
> news:1158695873.697272.313370@.i42g2000cwa.googlegr oups.com...
|||Replace the word 'server' with the actual name of your server, and the word
'instance' with the actual instance name of your SQL Server instance. If you
don't have a 'named' instance, then leave the slash and instance name off.
For example: "Data Source=MyComputer", or "Data Source=MyComputer\MSDE"
[vbcol=seagreen]
Each 'instance' is a separate SQL Server.
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
<sreedhardasi@.gmail.com> wrote in message
news:1158698297.475884.293360@.k70g2000cwa.googlegr oups.com...
> Thanks for your reply. Then, what would be the correct format?
> Arnie Rowland wrote:
>

ASP.NET 2.0 and connection to remote SQL 2000 server

Hi
I created ASP.NET 2.0 web application that uses SQL Server 2000 database and
it works perfectly when website and Sql server were on local machine.
Then I installed application on production server. Database is placed on
another server.
I received the 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 a connection to SQL Server)
Why it thinks I am trying to connect to SQL Server 2005 ? There is no any
2005 server on remote server!
This is my connection string:
Server=servername;Database=SOX;User ID=userxxx;Password=******;
Query Analyzer and Enterprise Manager connect perfectly (when installed on
production server) to database server! Then I created small console
appplication which uses the same data layer as web application (and
connection string ) - it connected to remote database too! Only ASP.NET
2.0 application couldn't connect to remote Sql server 2000.
Can anyone help?If there is no SQL Server 2005 installed on the server then
it looks like it's hitting the wrong server. Have you tried
using the IP address?
Double check the connection string and server name in the
connection string. On the IIS server, check for aliases and
entries in the host file that could cause it to go to the
wrong server. Log onto the server where IIS is installed and
ping the SQL Server box by name. Make sure the IP address
for the SQL Server box is correct and pointing to the
correct server.
-Sue
On Sat, 5 Aug 2006 23:06:33 +0300, "Mitya Mitriev"
<aaa@.stopspam.org> wrote:

>Hi
>I created ASP.NET 2.0 web application that uses SQL Server 2000 database an
d
>it works perfectly when website and Sql server were on local machine.
>Then I installed application on production server. Database is placed on
>another server.
>I received the 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 a connection to SQL Server)
>Why it thinks I am trying to connect to SQL Server 2005 ? There is no any
>2005 server on remote server!
>This is my connection string:
>Server=servername;Database=SOX;User ID=userxxx;Password=******;
>Query Analyzer and Enterprise Manager connect perfectly (when installed on
>production server) to database server! Then I created small console
>appplication which uses the same data layer as web application (and
>connection string ) - it connected to remote database too! Only ASP.NET
>2.0 application couldn't connect to remote Sql server 2000.
>Can anyone help?
>