Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Wednesday, March 28, 2012

Newbie question about installation

Hi,

I have just downloaded SQL Server 2005 Express Edition and am trying to run the setup. I have Windows XP Home Edition SP2 and I have received an error message saying that my operating system does not meet Service Pack level requirements. The documentation on the website shows that my service pack level is correct. Additionally the message suggests that I install the service pack from http://go.microsoft.com/fwlink/?LinkId=50380 but when I select that I get transferred to another web page which is unrelated.

Any ideas?

Did you install the .NET Framework on the machine (.NET 2.0 with additional fixes) ?

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de|||

I have seen a couple of people asking this question about the service pack, and it was already loaded on... One of the solutions that has been found is to re run the service pack install on the machine, I would try that.

|||Thanks for the suggestion. I have rerun the download and this time I have had no problem.sql

Newbie question : SQL Admin on Windows server 2003 small business edition.

I have noticed that although SQL server is packaged as part of windows 2003
server it does not include enterprise manager. How am i supposed to be able
to administor anythig, i thought i had seen an app mentioned that did it via
a web console but cannot find such an app.
I am trying to connect to my own SQL server and cannot, someone else has
tried to access it via their enterprise manager but they require a username
/ password, i have tried every password i can imagine that has been used for
the setup of the server, is there any way i can reset the pass or check what
it is?
As it's our server i have full admin rights on it.
Many thanks,
Moss
Assuming you mean SBS 2003 premium, did you select to install SQL Server in
the setup? Check under program files for Microsoft SQL Server directory. I
don't believe it installs automatically...
Kevin Hill
President
3NF Consulting
www.3nf-inc.com/NewsGroups.htm
www.DallasDBAs.com/forum - new DB forum for Dallas/Ft. Worth area DBAs.
"Moss" <koop@.o2.co.nsm> wrote in message
news:%23fn5$veWEHA.2340@.TK2MSFTNGP09.phx.gbl...
> I have noticed that although SQL server is packaged as part of windows
2003
> server it does not include enterprise manager. How am i supposed to be
able
> to administor anythig, i thought i had seen an app mentioned that did it
via
> a web console but cannot find such an app.
> I am trying to connect to my own SQL server and cannot, someone else has
> tried to access it via their enterprise manager but they require a
username
> / password, i have tried every password i can imagine that has been used
for
> the setup of the server, is there any way i can reset the pass or check
what
> it is?
> As it's our server i have full admin rights on it.
> Many thanks,
> Moss
>
sql

Newbie Question - Service Manager / Win 2003

Hi,

I'm running a Microsoft Windows 2003 Server computer, which is using a MS SQL server to feed our office application, OfficeTalk.

Due to the extreme size of the database, we have decided to install an external 1TB drive, and move the database to it.

The difficult bit we're finding is how to make it so that the service loads the new data source.

In other words, how do you use Service Manager to parse an argument to dbsvr.exe in order to change the database location?

Regards,
Matthew.Hi Mathew and welcome to TSDN MSSQL forum,

If you have an agreed maintenance slot where you can take the MSSQL server down, I would suggest do the following:

Back everything up
using enterprise manager detach on the database you want to move
copy the database to the new location
using enterprise manager attach the database by browsing to the new location.

If you get problems, backout by detaching the database in the new location and attach the old one.

Suggest you also try it out on a test DB, northwinds etc before you go for it for real..

Regards Purple

Monday, March 26, 2012

newbie question -- error when connecting via System DSN on any network but the SQL Servers

I'm very new to using SQL Server. All I'm trying to do at the moment, is
create a System DSN on a Windows 2000 Professional desktop machine to
connect to a SQL Server 2000 server which is running on a different
network. When I try the DSN while connected to the SAME network that the
SQL Server machine is on, it works fine. But when I connect from any
other network, I receive the following error:
Connection failed:
SQLState: '01000'
SQL Server Error: 10061
[Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]ConnectionOpent
(Connect()).
Connection failed:
SQLState: '08001'
SQL Server Error: 17
[Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]SQL Server does not
exist or access denied.

Here are the settings that I'm using for my System DSN:
Name: test
Which SQL Server do you want to connect to? 129.22.180.203
* With SQL Server Authentication using a login ID and password entered by
the user
* Connect to SQL Server to obtain default settings for the additional
configuration options
Login ID: SA
Password: <correct password entered
And in the Client Configuration:
Server Alias: 129.22.180.203
Network libraries: TCP/IP
Server Name: 129.22.180.203
* Dynamically determine port

Also, the driver is:
Microsoft SQL Server ODBC Driver version 03.85.1025

Please, if anyone has any ideas on what I am doing wrong, I can use all
the help I can get!!
--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/sheree <sah18@.case.edu> wrote in message news:<opsb5642gy6l2js5@.uh007637>...
> I'm very new to using SQL Server. All I'm trying to do at the moment, is
> create a System DSN on a Windows 2000 Professional desktop machine to
> connect to a SQL Server 2000 server which is running on a different
> network. When I try the DSN while connected to the SAME network that the
> SQL Server machine is on, it works fine. But when I connect from any
> other network, I receive the following error:
> Connection failed:
> SQLState: '01000'
> SQL Server Error: 10061
> [Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]ConnectionOpent
> (Connect()).
> Connection failed:
> SQLState: '08001'
> SQL Server Error: 17
> [Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]SQL Server does not
> exist or access denied.
> Here are the settings that I'm using for my System DSN:
> Name: test
> Which SQL Server do you want to connect to? 129.22.180.203
> * With SQL Server Authentication using a login ID and password entered by
> the user
> * Connect to SQL Server to obtain default settings for the additional
> configuration options
> Login ID: SA
> Password: <correct password entered>
> And in the Client Configuration:
> Server Alias: 129.22.180.203
> Network libraries: TCP/IP
> Server Name: 129.22.180.203
> * Dynamically determine port
> Also, the driver is:
> Microsoft SQL Server ODBC Driver version 03.85.1025
> Please, if anyone has any ideas on what I am doing wrong, I can use all
> the help I can get!!

I'm not sure what you mean by "a different network". If you mean that
the networks are physically separated by a firewall, or if you're
connecting over a VPN, then you might need to open the ports for
MSSQL:

http://support.microsoft.com/defaul...2&Product=sql2k

Simon|||Simon,
By "different network", I mean the following:
The SQL Server is running on a Windows 2000 Server machine that is located
on a University network. If I am on any machine that is also connected to
the University network, OR if I VPN into the University network, I can
successfully connect to the SQL Server in my DSN connection with the
parameters I gave in my original posting. However, if I try from my
office computer which is on a hospital network (and IS behind a firewall)
or if I try from any computer where I'm dialed up to my ISP (no firewall
would block anything here) I still can't connect to the SQL Server in my
DSN connection.
So I really don't think it's the port that is being blocked.

Are there any connection settings in SQL Server itself that I may have
configured incorrectly? Since I know so little about the software, I'm
not sure where even to begin to look.

Thanks for helping out!
-sheree

On 4 Aug 2004 01:16:19 -0700, Simon Hayes <sql@.hayes.ch> wrote:

> sheree <sah18@.case.edu> wrote in message
> news:<opsb5642gy6l2js5@.uh007637>...
>> I'm very new to using SQL Server. All I'm trying to do at the moment,
>> is
>> create a System DSN on a Windows 2000 Professional desktop machine to
>> connect to a SQL Server 2000 server which is running on a different
>> network. When I try the DSN while connected to the SAME network that
>> the
>> SQL Server machine is on, it works fine. But when I connect from any
>> other network, I receive the following error:
>> Connection failed:
>> SQLState: '01000'
>> SQL Server Error: 10061
>> [Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]ConnectionOpent
>> (Connect()).
>> Connection failed:
>> SQLState: '08001'
>> SQL Server Error: 17
>> [Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]SQL Server does not
>> exist or access denied.
>>
>> Here are the settings that I'm using for my System DSN:
>> Name: test
>> Which SQL Server do you want to connect to? 129.22.180.203
>> * With SQL Server Authentication using a login ID and password entered
>> by
>> the user
>> * Connect to SQL Server to obtain default settings for the additional
>> configuration options
>> Login ID: SA
>> Password: <correct password entered>
>>
>> And in the Client Configuration:
>> Server Alias: 129.22.180.203
>> Network libraries: TCP/IP
>> Server Name: 129.22.180.203
>> * Dynamically determine port
>>
>> Also, the driver is:
>> Microsoft SQL Server ODBC Driver version 03.85.1025
>>
>> Please, if anyone has any ideas on what I am doing wrong, I can use all
>> the help I can get!!
> I'm not sure what you mean by "a different network". If you mean that
> the networks are physically separated by a firewall, or if you're
> connecting over a VPN, then you might need to open the ports for
> MSSQL:
> http://support.microsoft.com/defaul...2&Product=sql2k
> Simon

--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/|||> However, if I try from my
> office computer which is on a hospital network (and IS behind a firewall)
> or if I try from any computer where I'm dialed up to my ISP (no firewall
> would block anything here) I still can't connect to the SQL Server in my
> DSN connection.
> So I really don't think it's the port that is being blocked.

From your description, it seems you are trying to connect over the public
internet to the SQL Server at your university. Port 1433 needs to be open
to allow this and it is likely that the firewall at the university has the
port closed for security reasons. It works when you are connected to the
university LAN or VPN because the firewall doesn't block 1433 in those
cases.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"sheree" <sah18@.case.edu> wrote in message
news:opsb7ky5r56l2js5@.v129-22-124-109.vclient.cwru.edu...
> Simon,
> By "different network", I mean the following:
> The SQL Server is running on a Windows 2000 Server machine that is located
> on a University network. If I am on any machine that is also connected to
> the University network, OR if I VPN into the University network, I can
> successfully connect to the SQL Server in my DSN connection with the
> parameters I gave in my original posting. However, if I try from my
> office computer which is on a hospital network (and IS behind a firewall)
> or if I try from any computer where I'm dialed up to my ISP (no firewall
> would block anything here) I still can't connect to the SQL Server in my
> DSN connection.
> So I really don't think it's the port that is being blocked.
> Are there any connection settings in SQL Server itself that I may have
> configured incorrectly? Since I know so little about the software, I'm
> not sure where even to begin to look.
> Thanks for helping out!
> -sheree
>
> On 4 Aug 2004 01:16:19 -0700, Simon Hayes <sql@.hayes.ch> wrote:
> > sheree <sah18@.case.edu> wrote in message
> > news:<opsb5642gy6l2js5@.uh007637>...
> >> I'm very new to using SQL Server. All I'm trying to do at the moment,
> >> is
> >> create a System DSN on a Windows 2000 Professional desktop machine to
> >> connect to a SQL Server 2000 server which is running on a different
> >> network. When I try the DSN while connected to the SAME network that
> >> the
> >> SQL Server machine is on, it works fine. But when I connect from any
> >> other network, I receive the following error:
> >> Connection failed:
> >> SQLState: '01000'
> >> SQL Server Error: 10061
> >> [Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]ConnectionOpent
> >> (Connect()).
> >> Connection failed:
> >> SQLState: '08001'
> >> SQL Server Error: 17
> >> [Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]SQL Server does not
> >> exist or access denied.
> >>
> >> Here are the settings that I'm using for my System DSN:
> >> Name: test
> >> Which SQL Server do you want to connect to? 129.22.180.203
> >> * With SQL Server Authentication using a login ID and password entered
> >> by
> >> the user
> >> * Connect to SQL Server to obtain default settings for the additional
> >> configuration options
> >> Login ID: SA
> >> Password: <correct password entered>
> >>
> >> And in the Client Configuration:
> >> Server Alias: 129.22.180.203
> >> Network libraries: TCP/IP
> >> Server Name: 129.22.180.203
> >> * Dynamically determine port
> >>
> >> Also, the driver is:
> >> Microsoft SQL Server ODBC Driver version 03.85.1025
> >>
> >> Please, if anyone has any ideas on what I am doing wrong, I can use all
> >> the help I can get!!
> > I'm not sure what you mean by "a different network". If you mean that
> > the networks are physically separated by a firewall, or if you're
> > connecting over a VPN, then you might need to open the ports for
> > MSSQL:
http://support.microsoft.com/defaul...2&Product=sql2k
> > Simon
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/m2/|||Dan,
Can another port be used for SQL Server to run on (rather than using the
default port 1433, which is what it is currently running on)? It might be
easier for me to use a different port that is already open at the
university, rather than attempt to request that they open port 1433
(unlikely they will do this).
Thanks so much for your help!
-sheree

On Wed, 04 Aug 2004 13:13:12 GMT, Dan Guzman
<danguzman@.nospam-earthlink.net> wrote:

> From your description, it seems you are trying to connect over the public
> internet to the SQL Server at your university. Port 1433 needs to be
> open
> to allow this and it is likely that the firewall at the university has
> the
> port closed for security reasons. It works when you are connected to the
> university LAN or VPN because the firewall doesn't block 1433 in those
> cases.|||sheree (sah18@.case.edu) writes:
> Can another port be used for SQL Server to run on (rather than using the
> default port 1433, which is what it is currently running on)? It might be
> easier for me to use a different port that is already open at the
> university, rather than attempt to request that they open port 1433

Yes, it is possible to use another port. (Which would affect everyone
using that server, as SQL Server uses only one port at a time.) No,
I don't think your university is likely to make SQL Server available on the
Internet on any port, least of all if you insist on using SQL Server
authentication.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Although it is certainly possible to configure SQL Server to listen on an
alternate port, it appears the SQL Server is configured to use 1433 because
your working local/VPN connections use the default port.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"sheree" <sah18@.case.edu> wrote in message
news:opsb7mufwi6l2js5@.v129-22-124-109.vclient.cwru.edu...
> Dan,
> Can another port be used for SQL Server to run on (rather than using the
> default port 1433, which is what it is currently running on)? It might be
> easier for me to use a different port that is already open at the
> university, rather than attempt to request that they open port 1433
> (unlikely they will do this).
> Thanks so much for your help!
> -sheree
>
> On Wed, 04 Aug 2004 13:13:12 GMT, Dan Guzman
> <danguzman@.nospam-earthlink.net> wrote:
> > From your description, it seems you are trying to connect over the
public
> > internet to the SQL Server at your university. Port 1433 needs to be
> > open
> > to allow this and it is likely that the firewall at the university has
> > the
> > port closed for security reasons. It works when you are connected to
the
> > university LAN or VPN because the firewall doesn't block 1433 in those
> > cases.

Friday, March 23, 2012

newbie question

I can connect to database stored on the sql server. But I cannot map drive
through windows xp. Any suggestions.
Lindac wrote:
> I can connect to database stored on the sql server. But I cannot map
> drive through windows xp. Any suggestions.
Are you trying to map a drive on the SQL Server box? If so, you need to
share the drive from the server to make it available to users on the
network.
SQL Server does not provide access to its data using file access (like
you used to do with dBase). It uses a network protocol like TCP/IP or
Named Pipes. The server listens on a specific TCP/IP port or a Named
Pipe "Pipe" and routes calls to the SQL Server service.
David G.

newbie question

I can connect to database stored on the sql server. But I cannot map drive
through windows xp. Any suggestions.Lindac wrote:
> I can connect to database stored on the sql server. But I cannot map
> drive through windows xp. Any suggestions.
Are you trying to map a drive on the SQL Server box? If so, you need to
share the drive from the server to make it available to users on the
network.
SQL Server does not provide access to its data using file access (like
you used to do with dBase). It uses a network protocol like TCP/IP or
Named Pipes. The server listens on a specific TCP/IP port or a Named
Pipe "Pipe" and routes calls to the SQL Server service.
David G.

Wednesday, March 21, 2012

newbie question

I can connect to database stored on the sql server. But I cannot map drive
through windows xp. Any suggestions.Lindac wrote:
> I can connect to database stored on the sql server. But I cannot map
> drive through windows xp. Any suggestions.
Are you trying to map a drive on the SQL Server box? If so, you need to
share the drive from the server to make it available to users on the
network.
SQL Server does not provide access to its data using file access (like
you used to do with dBase). It uses a network protocol like TCP/IP or
Named Pipes. The server listens on a specific TCP/IP port or a Named
Pipe "Pipe" and routes calls to the SQL Server service.
David G.

Newbie problem using Windows Groups and Schema

I created a Windows Group in Active Directory ("Database1Users"). populated it with users, and planned to allow everyone in it to have access to a sql 2005 database.

I went to the sql server, Security (at the general level), Logins, New login, and created the Login "<domain name>\Database1Users". I assigned "Database1" as Default database, selected the database and assigned it to the above user name (which is actually a group name). I also typed in a default schema of "dbo" and gave the user account the role "db_owner" (just learning....) . Pressing OK gave me this error message:

>>>>

The DEFAULT_SCHEMA clause can not be used with a Windows Group or with principals mapped to certificates or an asymmetric keys."

>>>>

Oh..... how am I supposed to map a Windows group to give the users the access they need?

TIA,

barkingdog

See this thread: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=159533&SiteID=1.

You can map a Windows group, just don't try setting a default schema for it.

Thanks
Laurentiu

sql

Monday, March 19, 2012

Newbie on permissions: ADO.NET, C++.NET, SQL SERVER 2005 EXPRESS, Visual Studio 2005

This is a very basic question, perhaps more of a Windows XP
Professional OS permissions question than a dB or programming
question: how to create and access SQL SERVER databases from an
account other than "Administrator"; for example, from a "Power User"
account?

As anything other than an "Administrator" user (i.e. as a Power User),
I keep getting (when I try from inside of MS Visual Studio 2005
development environment) the error message: "CREATE DATABASE
permission denied in database 'master'

Using the SQL Server Express Surface Area Configuration tool, I set
the parameters below to "enabled" (they were disabled). This only
helped in one respect: now I can create a database with Visual Studio
2005 (using the Server Explorer tool) when logged in as an
"Administrator". But for security reasons (which I'm not even sure
are valid, but at least in my mind they are) I would like to log in as
a Power User.

My configuration: Windows OS on a standalone Pentium 4 PC connected
to the internet--I'm using Visual Studio 2005 and programming in
C#.NET and C++.NET using ADO.NET. I don't need to access any other PC
in any network--I'm just learning the language at this point.

Any ideas? I did remove some prior versions of SQL Server '7' which
helped remove some other unrelated error messages, and, like I say,
from inside the Administrator account I can program and create
databases using the Server Explorer of Visual Studio 2005, but I'd
like to do so from a non-Admin account.

Also whether I can disable some of the parameters below--i.e., do I
really need the "xp_cmdshell" enabled?

Thanks!

RL

Configuring and Managing SQL Server Express
For improved manageability and security, SQL Server 2005 provides
more control over the SQL Server surface area on your system. To
minimize the surface area, the following default configurations have
been applied to your instance of SQL server:

oTCP/IP connections are disabled [changed to enabled]
oNamed Pipes is disabled [changed to enabled]
oSQL Browser must be started manually
oOPENROWSET and OPENDATASOURCE have been disabled
oCLR integration is disabled [changed to enabled]
oOLE automation is disabled [changed to enabled]
oxp_cmdshell is disabled [changed to enabled]

[This works fine but only from inside "Administrator"--RL]raylopez99 (raylopez99@.yahoo.com) writes:

Quote:

Originally Posted by

This is a very basic question, perhaps more of a Windows XP
Professional OS permissions question than a dB or programming
question: how to create and access SQL SERVER databases from an
account other than "Administrator"; for example, from a "Power User"
account?
>
As anything other than an "Administrator" user (i.e. as a Power User),
I keep getting (when I try from inside of MS Visual Studio 2005
development environment) the error message: "CREATE DATABASE
permission denied in database 'master'


That's indeed an issue of SQL Server permissions.

When you are logged in as an Administrator in Windows and connect to
SQL Server, you account maps to BUILTIN\Administrator which has sysadmin
privilege in SQL Server. That is, you can do anything.

WHen you connect with some other Windows user, no get no such extra
thrills, but you need to grant that login rights to do things. For instance

GRANT CREATE DATABASE TO DOMAIN\PowerUser

You can also add that user a role which has the privileges you want,
for instance to the sysadmin role.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||On Mar 28, 3:45 pm, Erland Sommarskog <esq...@.sommarskog.sewrote:

Quote:

Originally Posted by

raylopez99 (raylope...@.yahoo.com) writes:


Quote:

Originally Posted by

WHen you connect with some other Windows user, no get no such extra
thrills, but you need to grant that login rights to do things. For instance
>
GRANT CREATE DATABASE TO DOMAIN\PowerUser
>
You can also add that user a role which has the privileges you want,
for instance to the sysadmin role.
>
--
Erland Sommarskog, SQL Server MVP, esq...@.sommarskog.se
>


Erland Sommarskog-- thanks.

At the risk of looking even more stupid, if you know of how to "also
add that user a role which has the privileges you want, for instance
to the sysadmin role" within Visual Studio 2005 and/or Windows XP (for
the program SQL Server 2005 Express Edition), please feel free to let
me know. I just want to add the Power User to have Administrator
access for the Visual Studio 2005, when working on ADO.NET (SQL Server
2005), not for all programs, if possible. For now I will simply
program while logged in as an Administrator, which seems to be a good
workaround to my problem.

I've also ordered some books on ADO.NET and SQL SERVER from O'Reilly
and Microsoft Press; if you have any favorites for a C#/C++ programmer
hobbiest, let me know.

RL|||raylopez99 (raylopez99@.yahoo.com) writes:

Quote:

Originally Posted by

At the risk of looking even more stupid, if you know of how to "also
add that user a role which has the privileges you want, for instance
to the sysadmin role" within Visual Studio 2005 and/or Windows XP (for
the program SQL Server 2005 Express Edition), please feel free to let
me know. I just want to add the Power User to have Administrator
access for the Visual Studio 2005, when working on ADO.NET (SQL Server
2005), not for all programs, if possible. For now I will simply
program while logged in as an Administrator, which seems to be a good
workaround to my problem.


Do I understand this correctly that you want your user to have heavy
perms when connected through VS and your application, but not when it's
connected through Management Studio? There is no way you can assign
permissions per application. Permissions are per logins and users.

Of course, it's a legit requirement that a user should only be able to
access objects in the database through the application, as the application
then can control what the user can see and update. There are a couple of
ways to implement this requirement. The method that has been most tested
and rried is to use stored procedures. There are several ways that
permissions can be granted through stored procedures, whereof the most
useful is ownership chaining. If all stored procedures and tables are
owned by dbo, the users only need execute permissions to the stored
procedures.

There are ways to handle this without stored procedures, but I am less
of fond of these methods.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||On Mar 29, 3:03 pm, Erland Sommarskog <esq...@.sommarskog.sewrote:

Quote:

Originally Posted by

raylopez99 (raylope...@.yahoo.com) writes:


Quote:

Originally Posted by

>
Do I understand this correctly that you want your user to have heavy
perms when connected through VS and your application, but not when it's
connected through Management Studio? There is no way you can assign
permissions per application. Permissions are per logins and users.
>
Of course, it's a legit requirement that a user should only be able to
access objects in the database through the application, as the application
then can control what the user can see and update. There are a couple of
ways to implement this requirement. The method that has been most tested
and rried is to use stored procedures. There are several ways that
permissions can be granted through stored procedures, whereof the most
useful is ownership chaining. If all stored procedures and tables are
owned by dbo, the users only need execute permissions to the stored
procedures.
>
There are ways to handle this without stored procedures, but I am less
of fond of these methods.
>


Thank you Erland. I see the problem is not as simple as I thought. I
also see I have two problems: one is what you addressed, the other is
more simple: how to use VS2005 from an account other than
"Administrator" when working on databases. So far I've not been able
to figure out this, and only use "Adminstrator" to code. This simple
question can be answered by an experienced user of VS2005, and is to
an extent a trivial question since I can do programming in VS as
"Administrator" (it's annoying to switch users using Windows XP Pro,
but it's only an annoyance, nothing more).

THanks for your help,

RL|||raylopez99 (raylopez99@.yahoo.com) writes:

Quote:

Originally Posted by

Thank you Erland. I see the problem is not as simple as I thought. I
also see I have two problems: one is what you addressed, the other is
more simple: how to use VS2005 from an account other than
"Administrator" when working on databases. So far I've not been able
to figure out this, and only use "Adminstrator" to code.


I did not answer that question, since I was uncertain of the scope of
your question. But it's fairly simple, although there are several options.

One is to enable SQL Server Authentication through Management Studio.
(Right-click the server itself in the Object Explorer, select Properties
and go the the Security tab. You need to restart SQL Server for the
setting to take effect.) Then you can connect as sa from VS and have
sysadmin rights. The good thing with this is that when you connect
through your application with Windows authentication, you are a plain
user and can test that you have granted that user the right permissions.

The other option is to add your Windows user to the sysadmin role:

sp_addsrvrolemember 'sysadmin', 'MACHINE\User'

(If command fails, try swapping the parameters; I may not remember the
order correctly.)
You would first have to grant MACHINE\User access to the SQL Server.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||On Mar 30, 2:29 pm, Erland Sommarskog <esq...@.sommarskog.sewrote:

Quote:

Originally Posted by

raylopez99 (raylope...@.yahoo.com) writes:

Quote:

Originally Posted by

Thank you Erland. I see the problem is not as simple as I thought. I
also see I have two problems: one is what you addressed, the other is
more simple: how to use VS2005 from an account other than
"Administrator" when working on databases. So far I've not been able
to figure out this, and only use "Adminstrator" to code.


>
I did not answer that question, since I was uncertain of the scope of
your question. But it's fairly simple, although there are several options.
>
One is to enable SQL Server Authentication through Management Studio.
(Right-click the server itself in the Object Explorer, select Properties
and go the the Security tab. You need to restart SQL Server for the
setting to take effect.) Then you can connect as sa from VS and have
sysadmin rights. The good thing with this is that when you connect
through your application with Windows authentication, you are a plain
user and can test that you have granted that user the right permissions.
>


Well, turns out I don't have "Management Studio" on my system (yet
strangely I was able to create a simple SQL database and run some
commands). If you don't have "Management Studio" you don't have
"Object Explorer", even though it's possible to have SQL Server 2005
Express (a 36.5 MB file) and not the SQL Server Management Studio
Express (a 46.1 MB file) installed on your PC, as I have. Details
here: http://go.microsoft.com/fwlink/?LinkId=65110
I'll post again if I'm successful, for anybody reading this thread in
the future.

RL

Information on OE below...

Using Object Explorer

Object Explorer, a component of SQL Server Management Studio, connects
to Database Engine instances, Analysis Services, Integration Services,
Reporting Services, and SQL Server Compact Edition. It provides a view
of all the objects in the server and presents a user interface to
manage them. The capabilities of Object Explorer vary slightly
depending on the type of server, but generally include the development
features for databases, and management features for all server types.

Viewing Object Explorer

Object Explorer is visible in the Management Studio by default. If you
cannot see Object Explorer, on the View menu, click Object Explorer.

Connecting Object Explorer to a Server

To use Object Explorer you must first connect to a server. Click
Connect on the Object Explorer toolbar and choose the type of server
from the drop-down list. The Connect to Server dialog box opens. To
connect, you must provide at least the name of the server and the
correct authentication information.|||raylopez99 (raylopez99@.yahoo.com) writes:

Quote:

Originally Posted by

Well, turns out I don't have "Management Studio" on my system (yet
strangely I was able to create a simple SQL database and run some
commands). If you don't have "Management Studio" you don't have
"Object Explorer", even though it's possible to have SQL Server 2005
Express (a 36.5 MB file) and not the SQL Server Management Studio
Express (a 46.1 MB file) installed on your PC, as I have. Details
here: http://go.microsoft.com/fwlink/?LinkId=65110


I would definitely recommend that you download and install SQL Server
Management Studio Express. In the long run it will be difficult to be
without it. Particularly if you ask questions in newsgroups, because most
people answering questions will assume that you have Management Studio in
some form. :-)

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||On Mar 31, 2:42 pm, Erland Sommarskog <esq...@.sommarskog.sewrote:

Quote:

Originally Posted by

>
I would definitely recommend that you download and install SQL Server
Management Studio Express. In the long run it will be difficult to be
without it. Particularly if you ask questions in newsgroups, because most
people answering questions will assume that you have Management Studio in
some form. :-)
>
--
Erland Sommarskog, SQL Server MVP, esq...@.sommarskog.se


Hi Erland--it worked! Thank you very much, now I can code as a non-
Administrator with no problem...except one: http://tinyurl.com/38ssp8
(a sort of bug in VS2005 doing SQL it seems)

However, at least I did solve this problem and I appreciate your
advice.

Cheers,

Ray|||raylopez99 (raylopez99@.yahoo.com) writes:

Quote:

Originally Posted by

Hi Erland--it worked! Thank you very much, now I can code as a non-
Administrator with no problem...except one: http://tinyurl.com/38ssp8
(a sort of bug in VS2005 doing SQL it seems)


As I understand that link, it's not a bug at all. If you want to create
a procedure, you use CREATE PROCEDURE. If you want to change an existing
procedure, you use ALTER PROCEDURE. Alternatively, you drop the existing
procedure first, but then you would have to reapply permissions. Visual
Studio helps you out by changing CREATE to ALTER for you.

Also, one thing to keep in mind is that you enter things into the database,
that is not a Save operation, although unfortunately some tools use that
terminology. As with all other programming code, you save your code to disk
and then put it under version control. Regard what's in the database as
binaries.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Newbie needs code pages for SQL Server 2000 access from asp.net page using vb.net

I am only trying to connect to a local host .
I am on Windows 2000 Server with sql 2000 server.
My error is the classic "SQL server does not exist or access denied"
I went to the MS site & they tell me what I know....."some" permissioning
issue.
I had this code working 2 months ago on a different server but now I cannot
get it going now on a different
machine
I can setup ODBC connections every which way to this local server using
Integrated mode access
using different connectivity methods such as by using "local" or
<machinename> or 127.0.0.1 or <machine IP address>. I can also connect
using SQL authentication for user sa or some other new user I created.
So I am not sure about this access denied BS.
I need to connect to Northwind & pubs dbs (the sample dbs that come with sql
2000)
Please post the complete page in (without code behind crap for now).
I went to different sites & they have partial code & they cause different
errors ( I am not a Vb.net guru)
The page I used is something similar to below.
I am just trying to connect & print the server name & SQL version etc
'================ Sub Page_Load(Source As Object, E As EventArgs)
Dim strConnection1 As String = "server=localhost; database=Northwind; " & _
"integrated security=true"
Dim objConnection As New SqlConnection(strConnection)
Dim strSQL As String = "SELECT FirstName, LastName, Country " & _
"FROM Employees;"
Dim objCommand As New SqlCommand(strSQL, objConnection)
objConnection.Open()
Response.Write("ServerVersion: " & objConnection.ServerVersion & _
vbCRLF & "Datasource: " & objConnection.DataSource & _
vbCRLF & "Database: " & objConnection.Database)
dgNameList.DataSource = objCommand.ExecuteReader()
dgNameList.DataBind()
objConnection.Close()
End Sub
'==================
Can someone tell me what is wrong & also ALL the authentication settings
step by step I need in Windows 2000 server / SQL 2000 server ?
This is just the freaking local machine & server. I cannot believe this is
so hard.
Last time someone in some newsgroup had me play with registry settings to
make this work
in addition to some other Windows 2000 user changes
(Sorry I did not save it ...did not know this would be so bad)
I would prefer a complete code page that does both Integrated Auth (as
above) and also
SQL auth (using Username / PW).
(I know the actual call is a one or two line code but the exact format
without syntax or other errors is the key)
I don't have VS-7 so I cannot drag & drop the SQL connector control as
someone suggested.Lori,
When you are connecting to SQL server in integrated security mode IIS is
passing SQL server the account used to run the website. If you haven't
changed the web site to use impersonation (you would do that in the
web.config file) then the site is passing SQL server the anonymous login
account which the website would normally run under. Depending on your needs
their are multiple ways to configure this.
Here's a good article to get you started:
http://support.microsoft.com/default.aspx?scid=KB;EN-US;q176378
Sincerely,
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
www.aboutfortunate.com
"Out of chaos comes order."
Nietzche
"Lori" <__--LoriG--_@.yahoo.com> wrote in message
news:bjpt0d$li3vt$1@.ID-158805.news.uni-berlin.de...
>
> I am only trying to connect to a local host .
> I am on Windows 2000 Server with sql 2000 server.
>
> My error is the classic "SQL server does not exist or access denied"
> I went to the MS site & they tell me what I know....."some" permissioning
> issue.
> I had this code working 2 months ago on a different server but now I
cannot
> get it going now on a different
> machine
> I can setup ODBC connections every which way to this local server using
> Integrated mode access
> using different connectivity methods such as by using "local" or
> <machinename> or 127.0.0.1 or <machine IP address>. I can also connect
> using SQL authentication for user sa or some other new user I created.
> So I am not sure about this access denied BS.
> I need to connect to Northwind & pubs dbs (the sample dbs that come with
sql
> 2000)
> Please post the complete page in (without code behind crap for now).
> I went to different sites & they have partial code & they cause different
> errors ( I am not a Vb.net guru)
> The page I used is something similar to below.
> I am just trying to connect & print the server name & SQL version etc
> '================> Sub Page_Load(Source As Object, E As EventArgs)
> Dim strConnection1 As String = "server=localhost; database=Northwind; " &
_
> "integrated security=true"
> Dim objConnection As New SqlConnection(strConnection)
> Dim strSQL As String = "SELECT FirstName, LastName, Country " & _
> "FROM Employees;"
> Dim objCommand As New SqlCommand(strSQL, objConnection)
> objConnection.Open()
> Response.Write("ServerVersion: " & objConnection.ServerVersion & _
> vbCRLF & "Datasource: " & objConnection.DataSource & _
> vbCRLF & "Database: " & objConnection.Database)
> dgNameList.DataSource = objCommand.ExecuteReader()
> dgNameList.DataBind()
> objConnection.Close()
> End Sub
> '==================> Can someone tell me what is wrong & also ALL the authentication settings
> step by step I need in Windows 2000 server / SQL 2000 server ?
> This is just the freaking local machine & server. I cannot believe this is
> so hard.
> Last time someone in some newsgroup had me play with registry settings to
> make this work
> in addition to some other Windows 2000 user changes
> (Sorry I did not save it ...did not know this would be so bad)
> I would prefer a complete code page that does both Integrated Auth (as
> above) and also
> SQL auth (using Username / PW).
> (I know the actual call is a one or two line code but the exact format
> without syntax or other errors is the key)
>
> I don't have VS-7 so I cannot drag & drop the SQL connector control as
> someone suggested.
>
>
>
>|||"S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
news:eNMgDwGeDHA.1748@.TK2MSFTNGP10.phx.gbl...
> If you haven't
> changed the web site to use impersonation (you would do that in the
> web.config file) then the site is passing SQL server the anonymous login
> account which the website would normally run under.
I have no idea what you mean. Is there an error in logic such as your
sttement should read
======================> If you haven't
> changed the web site to use impersonation (you would do that in the
> web.config file) then the site is NOT passing SQL server the anonymous
login
> account which the website would normally run under
=============================
> Depending on your needs
> their are multiple ways to configure this.
> Here's a good article to get you started:
> http://support.microsoft.com/default.aspx?scid=KB;EN-US;q176378
The above site shows how to do a DSN connection.
I already said I am able to do a DSN conncection (but am not using it)
If you look at my sample code, it is a DSNless conncection, is it not ?|||And another thing.
The Microsoft error message is so misleading.
If there is a problem with IIS permissions why the hell does it say
"SQL server does not exist ?" Very helpful if troubleshooting is it not , by
misleading you ?
Also "access denied" by whom by SQL server ? By 2000 Server ? By IIS ?
Can they be anymore vague ?
"S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
news:eNMgDwGeDHA.1748@.TK2MSFTNGP10.phx.gbl...
> Lori,
> When you are connecting to SQL server in integrated security mode IIS is
> passing SQL server the account used to run the website. If you haven't
> changed the web site to use impersonation (you would do that in the
> web.config file) then the site is passing SQL server the anonymous login
> account which the website would normally run under. Depending on your
needs
> their are multiple ways to configure this.
> Here's a good article to get you started:
> http://support.microsoft.com/default.aspx?scid=KB;EN-US;q176378
> Sincerely,
> --
> S. Justin Gengo, MCP
> Web Developer
> Free code library at:
> www.aboutfortunate.com
> "Out of chaos comes order."
> Nietzche
>
> "Lori" <__--LoriG--_@.yahoo.com> wrote in message
> news:bjpt0d$li3vt$1@.ID-158805.news.uni-berlin.de...
> >
> >
> > I am only trying to connect to a local host .
> > I am on Windows 2000 Server with sql 2000 server.
> >
> >
> > My error is the classic "SQL server does not exist or access denied"
> > I went to the MS site & they tell me what I know....."some"
permissioning
> > issue.
> >
> > I had this code working 2 months ago on a different server but now I
> cannot
> > get it going now on a different
> > machine
> >
> > I can setup ODBC connections every which way to this local server using
> > Integrated mode access
> > using different connectivity methods such as by using "local" or
> > <machinename> or 127.0.0.1 or <machine IP address>. I can also connect
> > using SQL authentication for user sa or some other new user I created.
> > So I am not sure about this access denied BS.
> >
> > I need to connect to Northwind & pubs dbs (the sample dbs that come with
> sql
> > 2000)
> > Please post the complete page in (without code behind crap for now).
> >
> > I went to different sites & they have partial code & they cause
different
> > errors ( I am not a Vb.net guru)
> >
> > The page I used is something similar to below.
> >
> > I am just trying to connect & print the server name & SQL version etc
> >
> > '================> > Sub Page_Load(Source As Object, E As EventArgs)
> >
> > Dim strConnection1 As String = "server=localhost; database=Northwind; "
&
> _
> >
> > "integrated security=true"
> >
> > Dim objConnection As New SqlConnection(strConnection)
> >
> > Dim strSQL As String = "SELECT FirstName, LastName, Country " & _
> >
> > "FROM Employees;"
> >
> > Dim objCommand As New SqlCommand(strSQL, objConnection)
> >
> > objConnection.Open()
> >
> > Response.Write("ServerVersion: " & objConnection.ServerVersion & _
> >
> > vbCRLF & "Datasource: " & objConnection.DataSource & _
> >
> > vbCRLF & "Database: " & objConnection.Database)
> >
> > dgNameList.DataSource = objCommand.ExecuteReader()
> >
> > dgNameList.DataBind()
> >
> > objConnection.Close()
> >
> > End Sub
> >
> > '==================> >
> > Can someone tell me what is wrong & also ALL the authentication settings
> > step by step I need in Windows 2000 server / SQL 2000 server ?
> > This is just the freaking local machine & server. I cannot believe this
is
> > so hard.
> > Last time someone in some newsgroup had me play with registry settings
to
> > make this work
> > in addition to some other Windows 2000 user changes
> > (Sorry I did not save it ...did not know this would be so bad)
> >
> > I would prefer a complete code page that does both Integrated Auth (as
> > above) and also
> > SQL auth (using Username / PW).
> > (I know the actual call is a one or two line code but the exact format
> > without syntax or other errors is the key)
> >
> >
> > I don't have VS-7 so I cannot drag & drop the SQL connector control as
> > someone suggested.
> >
> >
> >
> >
> >
> >
> >
>|||What I am trying say is this
It would make more sense if the error message described that permission was
denied at one of the
possible 3 layers . Even the KB article does not make any references to the
IIS layer.
That said, I am not sure what user to add where in IIS
And another thing.
How would the SQL Auth. work ? Does it not go thru IIS also anyway,
regardless ?
"Lori" <__--LoriG--_@.yahoo.com> wrote in message
news:bjq07b$ljgdk$1@.ID-158805.news.uni-berlin.de...
> And another thing.
> The Microsoft error message is so misleading.
> If there is a problem with IIS permissions why the hell does it say
> "SQL server does not exist ?" Very helpful if troubleshooting is it not ,
by
> misleading you ?
> Also "access denied" by whom by SQL server ? By 2000 Server ? By IIS ?
> Can they be anymore vague ?
> "S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
> news:eNMgDwGeDHA.1748@.TK2MSFTNGP10.phx.gbl...
> > Lori,
> >
> > When you are connecting to SQL server in integrated security mode IIS is
> > passing SQL server the account used to run the website. If you haven't
> > changed the web site to use impersonation (you would do that in the
> > web.config file) then the site is passing SQL server the anonymous login
> > account which the website would normally run under. Depending on your
> needs
> > their are multiple ways to configure this.
> >
> > Here's a good article to get you started:
> >
> > http://support.microsoft.com/default.aspx?scid=KB;EN-US;q176378
> >
> > Sincerely,
> >
> > --
> > S. Justin Gengo, MCP
> > Web Developer
> >
> > Free code library at:
> > www.aboutfortunate.com
> >
> > "Out of chaos comes order."
> > Nietzche
> >
> >
> > "Lori" <__--LoriG--_@.yahoo.com> wrote in message
> > news:bjpt0d$li3vt$1@.ID-158805.news.uni-berlin.de...
> > >
> > >
> > > I am only trying to connect to a local host .
> > > I am on Windows 2000 Server with sql 2000 server.
> > >
> > >
> > > My error is the classic "SQL server does not exist or access denied"
> > > I went to the MS site & they tell me what I know....."some"
> permissioning
> > > issue.
> > >
> > > I had this code working 2 months ago on a different server but now I
> > cannot
> > > get it going now on a different
> > > machine
> > >
> > > I can setup ODBC connections every which way to this local server
using
> > > Integrated mode access
> > > using different connectivity methods such as by using "local" or
> > > <machinename> or 127.0.0.1 or <machine IP address>. I can also
connect
> > > using SQL authentication for user sa or some other new user I created.
> > > So I am not sure about this access denied BS.
> > >
> > > I need to connect to Northwind & pubs dbs (the sample dbs that come
with
> > sql
> > > 2000)
> > > Please post the complete page in (without code behind crap for now).
> > >
> > > I went to different sites & they have partial code & they cause
> different
> > > errors ( I am not a Vb.net guru)
> > >
> > > The page I used is something similar to below.
> > >
> > > I am just trying to connect & print the server name & SQL version etc
> > >
> > > '================> > > Sub Page_Load(Source As Object, E As EventArgs)
> > >
> > > Dim strConnection1 As String = "server=localhost; database=Northwind;
"
> &
> > _
> > >
> > > "integrated security=true"
> > >
> > > Dim objConnection As New SqlConnection(strConnection)
> > >
> > > Dim strSQL As String = "SELECT FirstName, LastName, Country " & _
> > >
> > > "FROM Employees;"
> > >
> > > Dim objCommand As New SqlCommand(strSQL, objConnection)
> > >
> > > objConnection.Open()
> > >
> > > Response.Write("ServerVersion: " & objConnection.ServerVersion & _
> > >
> > > vbCRLF & "Datasource: " & objConnection.DataSource & _
> > >
> > > vbCRLF & "Database: " & objConnection.Database)
> > >
> > > dgNameList.DataSource = objCommand.ExecuteReader()
> > >
> > > dgNameList.DataBind()
> > >
> > > objConnection.Close()
> > >
> > > End Sub
> > >
> > > '==================> > >
> > > Can someone tell me what is wrong & also ALL the authentication
settings
> > > step by step I need in Windows 2000 server / SQL 2000 server ?
> > > This is just the freaking local machine & server. I cannot believe
this
> is
> > > so hard.
> > > Last time someone in some newsgroup had me play with registry
settings
> to
> > > make this work
> > > in addition to some other Windows 2000 user changes
> > > (Sorry I did not save it ...did not know this would be so bad)
> > >
> > > I would prefer a complete code page that does both Integrated Auth (as
> > > above) and also
> > > SQL auth (using Username / PW).
> > > (I know the actual call is a one or two line code but the exact format
> > > without syntax or other errors is the key)
> > >
> > >
> > > I don't have VS-7 so I cannot drag & drop the SQL connector control as
> > > someone suggested.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
>|||Lori,
S. Justin Gengo, MCP
Web Developer
Free code library at:
www.aboutfortunate.com
"Out of chaos comes order."
Nietzche
"Lori" <__--LoriG--_@.yahoo.com> wrote in message
news:bjq07b$ljgdk$1@.ID-158805.news.uni-berlin.de...
> And another thing.
> The Microsoft error message is so misleading.
> If there is a problem with IIS permissions why the hell does it say
> "SQL server does not exist ?" Very helpful if troubleshooting is it not ,
by
> misleading you ?
> Also "access denied" by whom by SQL server ? By 2000 Server ? By IIS ?
> Can they be anymore vague ?
> "S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
> news:eNMgDwGeDHA.1748@.TK2MSFTNGP10.phx.gbl...
> > Lori,
> >
> > When you are connecting to SQL server in integrated security mode IIS is
> > passing SQL server the account used to run the website. If you haven't
> > changed the web site to use impersonation (you would do that in the
> > web.config file) then the site is passing SQL server the anonymous login
> > account which the website would normally run under. Depending on your
> needs
> > their are multiple ways to configure this.
> >
> > Here's a good article to get you started:
> >
> > http://support.microsoft.com/default.aspx?scid=KB;EN-US;q176378
> >
> > Sincerely,
> >
> > --
> > S. Justin Gengo, MCP
> > Web Developer
> >
> > Free code library at:
> > www.aboutfortunate.com
> >
> > "Out of chaos comes order."
> > Nietzche
> >
> >
> > "Lori" <__--LoriG--_@.yahoo.com> wrote in message
> > news:bjpt0d$li3vt$1@.ID-158805.news.uni-berlin.de...
> > >
> > >
> > > I am only trying to connect to a local host .
> > > I am on Windows 2000 Server with sql 2000 server.
> > >
> > >
> > > My error is the classic "SQL server does not exist or access denied"
> > > I went to the MS site & they tell me what I know....."some"
> permissioning
> > > issue.
> > >
> > > I had this code working 2 months ago on a different server but now I
> > cannot
> > > get it going now on a different
> > > machine
> > >
> > > I can setup ODBC connections every which way to this local server
using
> > > Integrated mode access
> > > using different connectivity methods such as by using "local" or
> > > <machinename> or 127.0.0.1 or <machine IP address>. I can also
connect
> > > using SQL authentication for user sa or some other new user I created.
> > > So I am not sure about this access denied BS.
> > >
> > > I need to connect to Northwind & pubs dbs (the sample dbs that come
with
> > sql
> > > 2000)
> > > Please post the complete page in (without code behind crap for now).
> > >
> > > I went to different sites & they have partial code & they cause
> different
> > > errors ( I am not a Vb.net guru)
> > >
> > > The page I used is something similar to below.
> > >
> > > I am just trying to connect & print the server name & SQL version etc
> > >
> > > '================> > > Sub Page_Load(Source As Object, E As EventArgs)
> > >
> > > Dim strConnection1 As String = "server=localhost; database=Northwind;
"
> &
> > _
> > >
> > > "integrated security=true"
> > >
> > > Dim objConnection As New SqlConnection(strConnection)
> > >
> > > Dim strSQL As String = "SELECT FirstName, LastName, Country " & _
> > >
> > > "FROM Employees;"
> > >
> > > Dim objCommand As New SqlCommand(strSQL, objConnection)
> > >
> > > objConnection.Open()
> > >
> > > Response.Write("ServerVersion: " & objConnection.ServerVersion & _
> > >
> > > vbCRLF & "Datasource: " & objConnection.DataSource & _
> > >
> > > vbCRLF & "Database: " & objConnection.Database)
> > >
> > > dgNameList.DataSource = objCommand.ExecuteReader()
> > >
> > > dgNameList.DataBind()
> > >
> > > objConnection.Close()
> > >
> > > End Sub
> > >
> > > '==================> > >
> > > Can someone tell me what is wrong & also ALL the authentication
settings
> > > step by step I need in Windows 2000 server / SQL 2000 server ?
> > > This is just the freaking local machine & server. I cannot believe
this
> is
> > > so hard.
> > > Last time someone in some newsgroup had me play with registry
settings
> to
> > > make this work
> > > in addition to some other Windows 2000 user changes
> > > (Sorry I did not save it ...did not know this would be so bad)
> > >
> > > I would prefer a complete code page that does both Integrated Auth (as
> > > above) and also
> > > SQL auth (using Username / PW).
> > > (I know the actual call is a one or two line code but the exact format
> > > without syntax or other errors is the key)
> > >
> > >
> > > I don't have VS-7 so I cannot drag & drop the SQL connector control as
> > > someone suggested.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
>|||Lori,
Sorry about that link. I copied and pasted the wrong one from my list.
Here's the right one:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/secnetch12.asp
Sincerely,
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
www.aboutfortunate.com
"Out of chaos comes order."
Nietzche
"Lori" <__--LoriG--_@.yahoo.com> wrote in message
news:bjq0u6$kldqf$1@.ID-158805.news.uni-berlin.de...
> What I am trying say is this
> It would make more sense if the error message described that permission
was
> denied at one of the
> possible 3 layers . Even the KB article does not make any references to
the
> IIS layer.
> That said, I am not sure what user to add where in IIS
> And another thing.
> How would the SQL Auth. work ? Does it not go thru IIS also anyway,
> regardless ?
>
> "Lori" <__--LoriG--_@.yahoo.com> wrote in message
> news:bjq07b$ljgdk$1@.ID-158805.news.uni-berlin.de...
> > And another thing.
> > The Microsoft error message is so misleading.
> > If there is a problem with IIS permissions why the hell does it say
> > "SQL server does not exist ?" Very helpful if troubleshooting is it not
,
> by
> > misleading you ?
> > Also "access denied" by whom by SQL server ? By 2000 Server ? By IIS ?
> > Can they be anymore vague ?
> >
> > "S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
> > news:eNMgDwGeDHA.1748@.TK2MSFTNGP10.phx.gbl...
> > > Lori,
> > >
> > > When you are connecting to SQL server in integrated security mode IIS
is
> > > passing SQL server the account used to run the website. If you haven't
> > > changed the web site to use impersonation (you would do that in the
> > > web.config file) then the site is passing SQL server the anonymous
login
> > > account which the website would normally run under. Depending on your
> > needs
> > > their are multiple ways to configure this.
> > >
> > > Here's a good article to get you started:
> > >
> > > http://support.microsoft.com/default.aspx?scid=KB;EN-US;q176378
> > >
> > > Sincerely,
> > >
> > > --
> > > S. Justin Gengo, MCP
> > > Web Developer
> > >
> > > Free code library at:
> > > www.aboutfortunate.com
> > >
> > > "Out of chaos comes order."
> > > Nietzche
> > >
> > >
> > > "Lori" <__--LoriG--_@.yahoo.com> wrote in message
> > > news:bjpt0d$li3vt$1@.ID-158805.news.uni-berlin.de...
> > > >
> > > >
> > > > I am only trying to connect to a local host .
> > > > I am on Windows 2000 Server with sql 2000 server.
> > > >
> > > >
> > > > My error is the classic "SQL server does not exist or access denied"
> > > > I went to the MS site & they tell me what I know....."some"
> > permissioning
> > > > issue.
> > > >
> > > > I had this code working 2 months ago on a different server but now I
> > > cannot
> > > > get it going now on a different
> > > > machine
> > > >
> > > > I can setup ODBC connections every which way to this local server
> using
> > > > Integrated mode access
> > > > using different connectivity methods such as by using "local" or
> > > > <machinename> or 127.0.0.1 or <machine IP address>. I can also
> connect
> > > > using SQL authentication for user sa or some other new user I
created.
> > > > So I am not sure about this access denied BS.
> > > >
> > > > I need to connect to Northwind & pubs dbs (the sample dbs that come
> with
> > > sql
> > > > 2000)
> > > > Please post the complete page in (without code behind crap for now).
> > > >
> > > > I went to different sites & they have partial code & they cause
> > different
> > > > errors ( I am not a Vb.net guru)
> > > >
> > > > The page I used is something similar to below.
> > > >
> > > > I am just trying to connect & print the server name & SQL version
etc
> > > >
> > > > '================> > > > Sub Page_Load(Source As Object, E As EventArgs)
> > > >
> > > > Dim strConnection1 As String = "server=localhost;
database=Northwind;
> "
> > &
> > > _
> > > >
> > > > "integrated security=true"
> > > >
> > > > Dim objConnection As New SqlConnection(strConnection)
> > > >
> > > > Dim strSQL As String = "SELECT FirstName, LastName, Country " & _
> > > >
> > > > "FROM Employees;"
> > > >
> > > > Dim objCommand As New SqlCommand(strSQL, objConnection)
> > > >
> > > > objConnection.Open()
> > > >
> > > > Response.Write("ServerVersion: " & objConnection.ServerVersion & _
> > > >
> > > > vbCRLF & "Datasource: " & objConnection.DataSource & _
> > > >
> > > > vbCRLF & "Database: " & objConnection.Database)
> > > >
> > > > dgNameList.DataSource = objCommand.ExecuteReader()
> > > >
> > > > dgNameList.DataBind()
> > > >
> > > > objConnection.Close()
> > > >
> > > > End Sub
> > > >
> > > > '==================> > > >
> > > > Can someone tell me what is wrong & also ALL the authentication
> settings
> > > > step by step I need in Windows 2000 server / SQL 2000 server ?
> > > > This is just the freaking local machine & server. I cannot believe
> this
> > is
> > > > so hard.
> > > > Last time someone in some newsgroup had me play with registry
> settings
> > to
> > > > make this work
> > > > in addition to some other Windows 2000 user changes
> > > > (Sorry I did not save it ...did not know this would be so bad)
> > > >
> > > > I would prefer a complete code page that does both Integrated Auth
(as
> > > > above) and also
> > > > SQL auth (using Username / PW).
> > > > (I know the actual call is a one or two line code but the exact
format
> > > > without syntax or other errors is the key)
> > > >
> > > >
> > > > I don't have VS-7 so I cannot drag & drop the SQL connector control
as
> > > > someone suggested.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>|||"S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
news:O6EeMLHeDHA.3224@.tk2msftngp13.phx.gbl...
> Lori,
>
?
Yes ?|||I appreciate the link but honestly, it is a typical Microsoft link.
They just thorough bits & pieces here & there.
What I need is this (to achieve the simple goal)
1. What I need to do at the Windows 2000 Server level ( User security
settings, Registry or whatever)
2. What I need to do at the IIS-5 level
3. The asp.net code page using vb.net (or even c# is fine).
I was hoping someone would already have the code page & tell me the
corresponding settings
for items 2 & 3 above on their machine to use the code.
I have done enough "fishing" on this & getting tired of it.
"S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
news:eCg4FNHeDHA.2320@.TK2MSFTNGP12.phx.gbl...
> Lori,
> Sorry about that link. I copied and pasted the wrong one from my list.
> Here's the right one:
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/secnetch12.asp
>
> Sincerely,
> --
> S. Justin Gengo, MCP
> Web Developer
> Free code library at:
> www.aboutfortunate.com
> "Out of chaos comes order."
> Nietzche
>
> "Lori" <__--LoriG--_@.yahoo.com> wrote in message
> news:bjq0u6$kldqf$1@.ID-158805.news.uni-berlin.de...
> > What I am trying say is this
> > It would make more sense if the error message described that permission
> was
> > denied at one of the
> > possible 3 layers . Even the KB article does not make any references to
> the
> > IIS layer.
> >
> > That said, I am not sure what user to add where in IIS
> >
> > And another thing.
> > How would the SQL Auth. work ? Does it not go thru IIS also anyway,
> > regardless ?
> >
> >
> > "Lori" <__--LoriG--_@.yahoo.com> wrote in message
> > news:bjq07b$ljgdk$1@.ID-158805.news.uni-berlin.de...
> > > And another thing.
> > > The Microsoft error message is so misleading.
> > > If there is a problem with IIS permissions why the hell does it say
> > > "SQL server does not exist ?" Very helpful if troubleshooting is it
not
> ,
> > by
> > > misleading you ?
> > > Also "access denied" by whom by SQL server ? By 2000 Server ? By IIS
?
> > > Can they be anymore vague ?
> > >
> > > "S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
> > > news:eNMgDwGeDHA.1748@.TK2MSFTNGP10.phx.gbl...
> > > > Lori,
> > > >
> > > > When you are connecting to SQL server in integrated security mode
IIS
> is
> > > > passing SQL server the account used to run the website. If you
haven't
> > > > changed the web site to use impersonation (you would do that in the
> > > > web.config file) then the site is passing SQL server the anonymous
> login
> > > > account which the website would normally run under. Depending on
your
> > > needs
> > > > their are multiple ways to configure this.
> > > >
> > > > Here's a good article to get you started:
> > > >
> > > > http://support.microsoft.com/default.aspx?scid=KB;EN-US;q176378
> > > >
> > > > Sincerely,
> > > >
> > > > --
> > > > S. Justin Gengo, MCP
> > > > Web Developer
> > > >
> > > > Free code library at:
> > > > www.aboutfortunate.com
> > > >
> > > > "Out of chaos comes order."
> > > > Nietzche
> > > >
> > > >
> > > > "Lori" <__--LoriG--_@.yahoo.com> wrote in message
> > > > news:bjpt0d$li3vt$1@.ID-158805.news.uni-berlin.de...
> > > > >
> > > > >
> > > > > I am only trying to connect to a local host .
> > > > > I am on Windows 2000 Server with sql 2000 server.
> > > > >
> > > > >
> > > > > My error is the classic "SQL server does not exist or access
denied"
> > > > > I went to the MS site & they tell me what I know....."some"
> > > permissioning
> > > > > issue.
> > > > >
> > > > > I had this code working 2 months ago on a different server but now
I
> > > > cannot
> > > > > get it going now on a different
> > > > > machine
> > > > >
> > > > > I can setup ODBC connections every which way to this local server
> > using
> > > > > Integrated mode access
> > > > > using different connectivity methods such as by using "local" or
> > > > > <machinename> or 127.0.0.1 or <machine IP address>. I can also
> > connect
> > > > > using SQL authentication for user sa or some other new user I
> created.
> > > > > So I am not sure about this access denied BS.
> > > > >
> > > > > I need to connect to Northwind & pubs dbs (the sample dbs that
come
> > with
> > > > sql
> > > > > 2000)
> > > > > Please post the complete page in (without code behind crap for
now).
> > > > >
> > > > > I went to different sites & they have partial code & they cause
> > > different
> > > > > errors ( I am not a Vb.net guru)
> > > > >
> > > > > The page I used is something similar to below.
> > > > >
> > > > > I am just trying to connect & print the server name & SQL version
> etc
> > > > >
> > > > > '================> > > > > Sub Page_Load(Source As Object, E As EventArgs)
> > > > >
> > > > > Dim strConnection1 As String = "server=localhost;
> database=Northwind;
> > "
> > > &
> > > > _
> > > > >
> > > > > "integrated security=true"
> > > > >
> > > > > Dim objConnection As New SqlConnection(strConnection)
> > > > >
> > > > > Dim strSQL As String = "SELECT FirstName, LastName, Country " & _
> > > > >
> > > > > "FROM Employees;"
> > > > >
> > > > > Dim objCommand As New SqlCommand(strSQL, objConnection)
> > > > >
> > > > > objConnection.Open()
> > > > >
> > > > > Response.Write("ServerVersion: " & objConnection.ServerVersion & _
> > > > >
> > > > > vbCRLF & "Datasource: " & objConnection.DataSource & _
> > > > >
> > > > > vbCRLF & "Database: " & objConnection.Database)
> > > > >
> > > > > dgNameList.DataSource = objCommand.ExecuteReader()
> > > > >
> > > > > dgNameList.DataBind()
> > > > >
> > > > > objConnection.Close()
> > > > >
> > > > > End Sub
> > > > >
> > > > > '==================> > > > >
> > > > > Can someone tell me what is wrong & also ALL the authentication
> > settings
> > > > > step by step I need in Windows 2000 server / SQL 2000 server ?
> > > > > This is just the freaking local machine & server. I cannot believe
> > this
> > > is
> > > > > so hard.
> > > > > Last time someone in some newsgroup had me play with registry
> > settings
> > > to
> > > > > make this work
> > > > > in addition to some other Windows 2000 user changes
> > > > > (Sorry I did not save it ...did not know this would be so bad)
> > > > >
> > > > > I would prefer a complete code page that does both Integrated Auth
> (as
> > > > > above) and also
> > > > > SQL auth (using Username / PW).
> > > > > (I know the actual call is a one or two line code but the exact
> format
> > > > > without syntax or other errors is the key)
> > > > >
> > > > >
> > > > > I don't have VS-7 so I cannot drag & drop the SQL connector
control
> as
> > > > > someone suggested.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>|||Actually it should read like this
1. What I need to do at the Windows 2000 Server level ( User security
settings, Registry or whatever)
2. What I need to set at the SQL server 2000 level
3. What I need to do at the IIS-5 level
4. The asp.net code page using vb.net (or even c# is fine) & the project
file including web.config file if any
I ran into 100's code pages ( Item 4 ) that tells you how to connect but
none of them address other layers
(Items 1 thru 3 above)
I am hoping some of you can tell me your machine configs for items 1 thru 3
above.
I think item 4 is ok with what I have. (And I suspect item 2 is OK 2 for me)
It is the OS level or IIS settings that are always a pain.
It is amazing how painful it is for even everything local to same machine
"Lori" <__--LoriG--_@.yahoo.com> wrote in message
news:bjqbou$ltkeg$1@.ID-158805.news.uni-berlin.de...
> I appreciate the link but honestly, it is a typical Microsoft link.
> They just thorough bits & pieces here & there.
> What I need is this (to achieve the simple goal)
> 1. What I need to do at the Windows 2000 Server level ( User security
> settings, Registry or whatever)
> 2. What I need to do at the IIS-5 level
> 3. The asp.net code page using vb.net (or even c# is fine).
> I was hoping someone would already have the code page & tell me the
> corresponding settings
> for items 2 & 3 above on their machine to use the code.
> I have done enough "fishing" on this & getting tired of it.
>
>
> "S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
> news:eCg4FNHeDHA.2320@.TK2MSFTNGP12.phx.gbl...
> > Lori,
> >
> > Sorry about that link. I copied and pasted the wrong one from my list.
> >
> > Here's the right one:
> >
> >
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/secnetch12.asp
> >
> >
> > Sincerely,
> >
> > --
> > S. Justin Gengo, MCP
> > Web Developer
> >
> > Free code library at:
> > www.aboutfortunate.com
> >
> > "Out of chaos comes order."
> > Nietzche
> >
> >
> > "Lori" <__--LoriG--_@.yahoo.com> wrote in message
> > news:bjq0u6$kldqf$1@.ID-158805.news.uni-berlin.de...
> > > What I am trying say is this
> > > It would make more sense if the error message described that
permission
> > was
> > > denied at one of the
> > > possible 3 layers . Even the KB article does not make any references
to
> > the
> > > IIS layer.
> > >
> > > That said, I am not sure what user to add where in IIS
> > >
> > > And another thing.
> > > How would the SQL Auth. work ? Does it not go thru IIS also anyway,
> > > regardless ?
> > >
> > >
> > > "Lori" <__--LoriG--_@.yahoo.com> wrote in message
> > > news:bjq07b$ljgdk$1@.ID-158805.news.uni-berlin.de...
> > > > And another thing.
> > > > The Microsoft error message is so misleading.
> > > > If there is a problem with IIS permissions why the hell does it say
> > > > "SQL server does not exist ?" Very helpful if troubleshooting is it
> not
> > ,
> > > by
> > > > misleading you ?
> > > > Also "access denied" by whom by SQL server ? By 2000 Server ? By
IIS
> ?
> > > > Can they be anymore vague ?
> > > >
> > > > "S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
> > > > news:eNMgDwGeDHA.1748@.TK2MSFTNGP10.phx.gbl...
> > > > > Lori,
> > > > >
> > > > > When you are connecting to SQL server in integrated security mode
> IIS
> > is
> > > > > passing SQL server the account used to run the website. If you
> haven't
> > > > > changed the web site to use impersonation (you would do that in
the
> > > > > web.config file) then the site is passing SQL server the anonymous
> > login
> > > > > account which the website would normally run under. Depending on
> your
> > > > needs
> > > > > their are multiple ways to configure this.
> > > > >
> > > > > Here's a good article to get you started:
> > > > >
> > > > > http://support.microsoft.com/default.aspx?scid=KB;EN-US;q176378
> > > > >
> > > > > Sincerely,
> > > > >
> > > > > --
> > > > > S. Justin Gengo, MCP
> > > > > Web Developer
> > > > >
> > > > > Free code library at:
> > > > > www.aboutfortunate.com
> > > > >
> > > > > "Out of chaos comes order."
> > > > > Nietzche
> > > > >
> > > > >
> > > > > "Lori" <__--LoriG--_@.yahoo.com> wrote in message
> > > > > news:bjpt0d$li3vt$1@.ID-158805.news.uni-berlin.de...
> > > > > >
> > > > > >
> > > > > > I am only trying to connect to a local host .
> > > > > > I am on Windows 2000 Server with sql 2000 server.
> > > > > >
> > > > > >
> > > > > > My error is the classic "SQL server does not exist or access
> denied"
> > > > > > I went to the MS site & they tell me what I know....."some"
> > > > permissioning
> > > > > > issue.
> > > > > >
> > > > > > I had this code working 2 months ago on a different server but
now
> I
> > > > > cannot
> > > > > > get it going now on a different
> > > > > > machine
> > > > > >
> > > > > > I can setup ODBC connections every which way to this local
server
> > > using
> > > > > > Integrated mode access
> > > > > > using different connectivity methods such as by using "local" or
> > > > > > <machinename> or 127.0.0.1 or <machine IP address>. I can also
> > > connect
> > > > > > using SQL authentication for user sa or some other new user I
> > created.
> > > > > > So I am not sure about this access denied BS.
> > > > > >
> > > > > > I need to connect to Northwind & pubs dbs (the sample dbs that
> come
> > > with
> > > > > sql
> > > > > > 2000)
> > > > > > Please post the complete page in (without code behind crap for
> now).
> > > > > >
> > > > > > I went to different sites & they have partial code & they cause
> > > > different
> > > > > > errors ( I am not a Vb.net guru)
> > > > > >
> > > > > > The page I used is something similar to below.
> > > > > >
> > > > > > I am just trying to connect & print the server name & SQL
version
> > etc
> > > > > >
> > > > > > '================> > > > > > Sub Page_Load(Source As Object, E As EventArgs)
> > > > > >
> > > > > > Dim strConnection1 As String = "server=localhost;
> > database=Northwind;
> > > "
> > > > &
> > > > > _
> > > > > >
> > > > > > "integrated security=true"
> > > > > >
> > > > > > Dim objConnection As New SqlConnection(strConnection)
> > > > > >
> > > > > > Dim strSQL As String = "SELECT FirstName, LastName, Country " &
_
> > > > > >
> > > > > > "FROM Employees;"
> > > > > >
> > > > > > Dim objCommand As New SqlCommand(strSQL, objConnection)
> > > > > >
> > > > > > objConnection.Open()
> > > > > >
> > > > > > Response.Write("ServerVersion: " & objConnection.ServerVersion &
_
> > > > > >
> > > > > > vbCRLF & "Datasource: " & objConnection.DataSource & _
> > > > > >
> > > > > > vbCRLF & "Database: " & objConnection.Database)
> > > > > >
> > > > > > dgNameList.DataSource = objCommand.ExecuteReader()
> > > > > >
> > > > > > dgNameList.DataBind()
> > > > > >
> > > > > > objConnection.Close()
> > > > > >
> > > > > > End Sub
> > > > > >
> > > > > > '==================> > > > > >
> > > > > > Can someone tell me what is wrong & also ALL the authentication
> > > settings
> > > > > > step by step I need in Windows 2000 server / SQL 2000 server ?
> > > > > > This is just the freaking local machine & server. I cannot
believe
> > > this
> > > > is
> > > > > > so hard.
> > > > > > Last time someone in some newsgroup had me play with registry
> > > settings
> > > > to
> > > > > > make this work
> > > > > > in addition to some other Windows 2000 user changes
> > > > > > (Sorry I did not save it ...did not know this would be so bad)
> > > > > >
> > > > > > I would prefer a complete code page that does both Integrated
Auth
> > (as
> > > > > > above) and also
> > > > > > SQL auth (using Username / PW).
> > > > > > (I know the actual call is a one or two line code but the exact
> > format
> > > > > > without syntax or other errors is the key)
> > > > > >
> > > > > >
> > > > > > I don't have VS-7 so I cannot drag & drop the SQL connector
> control
> > as
> > > > > > someone suggested.
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>

Monday, March 12, 2012

Newbie Merge replication question

Hi!

I'm setting up a merge replication for sql ce. Ten guys with windows mobile 5 pocket pc works as service technicians and need to synchronize data in the field.

The backend database is huge and I just want each person to have their own data on the pda and synchronized, they have unique userid's in the database. Is it possible to filter data for each person or do all have to have all data that's in the backend database?

/Magnus

Merge replication permits the agents to have subsets of the data based on how the Publication is programmed. One alternate approach would be to publish individual agent tables, but this gets messy as agents are added and removed.|||Could I use a "translator" table to translate suser_name()'s to applications userid's? Then in the filter query against this table to identify the user? One solution could be to have one Publication for each employee? Yes it would become messy to administer. But my problem can't be unique. How do you all query out data for each employee?|||You could have each user identifying themselves when using the application, and setting their userid as HostName on your replication object. Then you can reference this in your publication filter with HOST_NAME().

Newbie Merge replication question

Hi!

I'm setting up a merge replication for sql ce. Ten guys with windows mobile 5 pocket pc works as service technicians and need to synchronize data in the field.

The backend database is huge and I just want each person to have their own data on the pda and synchronized, they have unique userid's in the database. Is it possible to filter data for each person or do all have to have all data that's in the backend database?

/Magnus

Merge replication permits the agents to have subsets of the data based on how the Publication is programmed. One alternate approach would be to publish individual agent tables, but this gets messy as agents are added and removed.|||Could I use a "translator" table to translate suser_name()'s to applications userid's? Then in the filter query against this table to identify the user? One solution could be to have one Publication for each employee? Yes it would become messy to administer. But my problem can't be unique. How do you all query out data for each employee?|||You could have each user identifying themselves when using the application, and setting their userid as HostName on your replication object. Then you can reference this in your publication filter with HOST_NAME().

Friday, March 9, 2012

newbie having trouble with SQL connection, insert/update

Thanks to anyone who helps!
I'm building a data entry windows form that requires the data to
be sent to a SQL Server table (the table's name is "Local") when the
form's "SAVE" button is clicked. I've built the form using the windows
form designer, and now I'm attempting to use SQL statements to
insert/update data into the table. There are six fields that will use
SQL statements to send data to the Local table, and none of the fields
are permitted to be null values. Two of the fields are comboboxes that
are populated through the use of their own respective datasets
(DisasterType and Dwelling); the datasets were built using the forms
designer OLEdbDataAdapter. Three fields are textboxes(FamilyName,
WorkerName, and DamageDescGeneral) that require the user to manually
enter data. Finally, there is a checkbox (Utilities) that should be
checked if the parameter is "yes/true."
My main problem is that I don't know the correct SQL code that
will allow
the data to be inserted/updated into the Local table. Or, can the
issue be solved using the forms designer? There are also two other
issues.
1. The datatypes of the "Disaster Type" and "Dwelling" fields have to
be changed before being sent to the Local table. I am using the more
user-readable names and descriptions of the respective fields to
populate the form, rather than their Primary Key ID's. However, their
Primary Keys are also Foreign Keys in the Local table, so their
datatypes have to be changed. You'll see this attempted conversion in
the "//convert Disaster_Type to Disaster_ID" and "//convert
Dwelling_Desc to Dwelling_Type" statements. The compiler doesn't
recognize the While statement I'm using. Here is the error: Cannot
find method 'While(boolean)' in 'ArcMaster.frmLocal'
2. The datatype for the Utilities column in the Local table is a bit
value, but the datatype on the windows form is a boolean checkbox. I
need to be able to convert from boolean to bit through the use of an If
statement, but I keep getting errors. Here are my compile errors under
the current configuration:
Type 'boolean' is not assignable to 'Object'
Type 'int' is not assignable to 'Object'
I've included my code. I KNOW it's wrong, and I'm hoping
someone can
assist me. Thanks again!!!
import System.Drawing.*;
import System.Collections.*;
import System.ComponentModel.*;
import System.Windows.Forms.*;
import System.Data.*;
import System.Data.SqlClient.*;
import System.*;
/**
* Summary description for Local.
*/
public class frmLocal extends System.Windows.Forms.Form
{
//windows forms designer variables
private System.Windows.Forms.Label lblTitle;
private System.Windows.Forms.TextBox txtFamilyName;
private System.Windows.Forms.Label lblFamilyName;
private System.Windows.Forms.TextBox txtWorkerName;
private System.Windows.Forms.Label lblWorkerName;
private System.Windows.Forms.Label lblDisasterType;
private System.Windows.Forms.ComboBox cboDisasterType;
private System.Windows.Forms.Label lblDwellingType;
private System.Windows.Forms.ComboBox cboDwellingType;
private System.Windows.Forms.Label lblUtilities;
private System.Windows.Forms.Label lblDegreeOfDamage;
private System.Windows.Forms.Label lblDamageDescGeneral;
private System.Windows.Forms.TextBox txtDamageDescGeneral;
private System.Windows.Forms.Button cmdCloseWindow;
private System.Windows.Forms.Button cmdClearEntry;
private System.Windows.Forms.Button cmdSave;
private System.Data.OleDb.OleDbConnection oleDbConnection1;
private System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter3;
private System.Data.OleDb.OleDbCommand oleDbSelectCommand3;
private System.Data.OleDb.OleDbCommand oleDbInsertCommand3;
private System.Data.OleDb.OleDbCommand oleDbUpdateCommand3;
private System.Data.OleDb.OleDbCommand oleDbDeleteCommand3;
private ArcMaster.dsDisasterType dsDisasterType1;
private System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter4;
private System.Data.OleDb.OleDbCommand oleDbSelectCommand4;
private System.Data.OleDb.OleDbCommand oleDbInsertCommand4;
private System.Data.OleDb.OleDbCommand oleDbUpdateCommand4;
private System.Data.OleDb.OleDbCommand oleDbDeleteCommand4;
private ArcMaster.dsDwelling dsDwelling1;
private System.Windows.Forms.CheckBox chkUtilities;
/**
* Required designer variable.
*/
private System.ComponentModel.Container components = null;
public frmLocal()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent
call
//
}
/**
* Clean up any resources being used.
*/
protected void Dispose(boolean disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
super.Dispose(disposing);
}
#region Windows Form Designer generated code
private void frmLocal_Load (Object sender, System.EventArgs e)
{
//populate disaster type combobox with data from Disaster_Type
table
dsDisasterType1.Clear();
oleDbDataAdapter3.Fill(dsDisasterType1);
oleDbConnection1.Close();
//populate dwelling type combobox with data from Dwelling table
dsDwelling1.Clear();
oleDbDataAdapter4.Fill(dsDwelling1);
oleDbConnection1.Close();
}
private void cmdSave_Click (Object sender, System.EventArgs e)
{
//SQL variables
Object sql;
SqlConnection cn;
DataSet dsLocal = new DataSet();
SqlDataAdapter da = new SqlDataAdapter();
SqlCommand myCommand;
SqlDataReader reader;
//initialize the variables that handle data to be bound to
Local table;
Object FamilyName = txtFamilyName.get_Text();
Object Dwelling = cboDwellingType.get_SelectedItem();
Object DisasterType = cboDisasterType.get_SelectedItem();
Object WorkerName = txtWorkerName.get_Text();
Object DamageDescGeneral = txtDamageDescGeneral.get_Text();
Object Utilities = chkUtilities.get_CheckState();
//Set the connection string of the SqlConnection object to
connect to the ARC database
cn = new SqlConnection("Server=METZLER"+
"Integrated security=SSPI;" +
"database=ARC");
myCommand= new SqlCommand(sql, cn);
cn.Open();
//convert Disaster_Type to Disaster_ID
sql = "SELECT Disaster_ID FROM Disaster_Type WHERE
((Disaster_Name = " + DisasterType + " ))";
reader = myCommand.ExecuteReader();
While(reader.Read());
{
DisasterType = reader.GetValue(0);
}
reader.Close();
//convert Dwelling_Desc to Dwelling_Type
sql = "SELECT Dwelling_Type FROM Dwelling WHERE ((Dwelling_Desc
= " + Dwelling + "))";
reader = myCommand.ExecuteReader();
While(reader.Read());
{
Dwelling = reader.GetValue(0);
}
reader.Close();
//Initialize the SqlCommandBuilder object to automatically
generate and
//initialize the UpdateCommand, the InsertCommand, and the
DeleteCommand
//properties of the SqlDataAdapter.
cmdBuilder = new SqlCommandBuilder(da);
da.Fill(dsLocal, "Local");
//convert Utilites data from text datatype to bit datatype
If (Utilities = true);
{
Utilities = 1;
}
If (Utilities = false);
{
Utilities = 0;
}
//SQL statement to insert data into Local table
sql = "INSERT INTO Local (Local_rowguid, ARC_Worker,
Description, Disaster_ID, Dwelling_Type, Family_Name, Utilities)" +
"VALUES (NewID(),'" + WorkerName + "', '" + DamageDescGeneral
+ "',
'" + DisasterType + "', '" + Dwelling + "', '" + FamilyName + "', '" +
Utilities;
da.Update(dsLocal, "Local");
//oleDbDataAdapter4.Update(dsDescriptionOfDamage1);
//oleDbConnection1.Close();
//dsLocal1.Clear();
//oleDbDataAdapter4.Update(dsLocal1);
//oleDbDataAdapter4.Fill(dsLocal1);
//oleDbConnection1.Close();
//oleDbConnection1.Close();
//Close the database connection.
cn.Close();
MessageBox.Show("Local Detailed Damage Assessment has been
updated.");
}
private void cmdCloseWindow_Click (Object sender, System.EventArgs e)
{
Close();Hi
You insert statement does not have a closing bracket, you also seem to be
making values strings by enquoting them when they are not character data
types. You could form the sql string differently depending on whether
utility is true or not.
John
"pmetz" <p1metzler@.yahoo.com> wrote in message
news:1144497354.135933.54280@.i40g2000cwc.googlegroups.com...
>
> Thanks to anyone who helps!
> I'm building a data entry windows form that requires the data to
> be sent to a SQL Server table (the table's name is "Local") when the
> form's "SAVE" button is clicked. I've built the form using the windows
>
> form designer, and now I'm attempting to use SQL statements to
> insert/update data into the table. There are six fields that will use
> SQL statements to send data to the Local table, and none of the fields
> are permitted to be null values. Two of the fields are comboboxes that
>
> are populated through the use of their own respective datasets
> (DisasterType and Dwelling); the datasets were built using the forms
> designer OLEdbDataAdapter. Three fields are textboxes(FamilyName,
> WorkerName, and DamageDescGeneral) that require the user to manually
> enter data. Finally, there is a checkbox (Utilities) that should be
> checked if the parameter is "yes/true."
> My main problem is that I don't know the correct SQL code that
> will allow
> the data to be inserted/updated into the Local table. Or, can the
> issue be solved using the forms designer? There are also two other
> issues.
>
> 1. The datatypes of the "Disaster Type" and "Dwelling" fields have to
> be changed before being sent to the Local table. I am using the more
> user-readable names and descriptions of the respective fields to
> populate the form, rather than their Primary Key ID's. However, their
> Primary Keys are also Foreign Keys in the Local table, so their
> datatypes have to be changed. You'll see this attempted conversion in
> the "//convert Disaster_Type to Disaster_ID" and "//convert
> Dwelling_Desc to Dwelling_Type" statements. The compiler doesn't
> recognize the While statement I'm using. Here is the error: Cannot
> find method 'While(boolean)' in 'ArcMaster.frmLocal'
>
> 2. The datatype for the Utilities column in the Local table is a bit
> value, but the datatype on the windows form is a boolean checkbox. I
> need to be able to convert from boolean to bit through the use of an If
>
> statement, but I keep getting errors. Here are my compile errors under
>
> the current configuration:
> Type 'boolean' is not assignable to 'Object'
> Type 'int' is not assignable to 'Object'
>
> I've included my code. I KNOW it's wrong, and I'm hoping
> someone can
> assist me. Thanks again!!!
>
> import System.Drawing.*;
> import System.Collections.*;
> import System.ComponentModel.*;
> import System.Windows.Forms.*;
> import System.Data.*;
> import System.Data.SqlClient.*;
> import System.*;
>
> /**
> * Summary description for Local.
> */
> public class frmLocal extends System.Windows.Forms.Form
> {
>
> //windows forms designer variables
> private System.Windows.Forms.Label lblTitle;
> private System.Windows.Forms.TextBox txtFamilyName;
> private System.Windows.Forms.Label lblFamilyName;
> private System.Windows.Forms.TextBox txtWorkerName;
> private System.Windows.Forms.Label lblWorkerName;
> private System.Windows.Forms.Label lblDisasterType;
> private System.Windows.Forms.ComboBox cboDisasterType;
> private System.Windows.Forms.Label lblDwellingType;
> private System.Windows.Forms.ComboBox cboDwellingType;
> private System.Windows.Forms.Label lblUtilities;
> private System.Windows.Forms.Label lblDegreeOfDamage;
> private System.Windows.Forms.Label lblDamageDescGeneral;
> private System.Windows.Forms.TextBox txtDamageDescGeneral;
> private System.Windows.Forms.Button cmdCloseWindow;
> private System.Windows.Forms.Button cmdClearEntry;
> private System.Windows.Forms.Button cmdSave;
> private System.Data.OleDb.OleDbConnection oleDbConnection1;
> private System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter3;
> private System.Data.OleDb.OleDbCommand oleDbSelectCommand3;
> private System.Data.OleDb.OleDbCommand oleDbInsertCommand3;
> private System.Data.OleDb.OleDbCommand oleDbUpdateCommand3;
> private System.Data.OleDb.OleDbCommand oleDbDeleteCommand3;
> private ArcMaster.dsDisasterType dsDisasterType1;
> private System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter4;
> private System.Data.OleDb.OleDbCommand oleDbSelectCommand4;
> private System.Data.OleDb.OleDbCommand oleDbInsertCommand4;
> private System.Data.OleDb.OleDbCommand oleDbUpdateCommand4;
> private System.Data.OleDb.OleDbCommand oleDbDeleteCommand4;
> private ArcMaster.dsDwelling dsDwelling1;
> private System.Windows.Forms.CheckBox chkUtilities;
>
> /**
> * Required designer variable.
> */
> private System.ComponentModel.Container components = null;
>
> public frmLocal()
> {
> //
> // Required for Windows Form Designer support
> //
> InitializeComponent();
>
> //
> // TODO: Add any constructor code after InitializeComponent
> call
> //
>
> }
>
> /**
> * Clean up any resources being used.
> */
> protected void Dispose(boolean disposing)
> {
> if (disposing)
> {
> if (components != null)
> {
> components.Dispose();
> }
> }
> super.Dispose(disposing);
>
> }
>
> #region Windows Form Designer generated code
> private void frmLocal_Load (Object sender, System.EventArgs e)
> {
> //populate disaster type combobox with data from Disaster_Type
> table
> dsDisasterType1.Clear();
> oleDbDataAdapter3.Fill(dsDisasterType1);
> oleDbConnection1.Close();
>
> //populate dwelling type combobox with data from Dwelling table
>
> dsDwelling1.Clear();
> oleDbDataAdapter4.Fill(dsDwelling1);
> oleDbConnection1.Close();
>
> }
>
> private void cmdSave_Click (Object sender, System.EventArgs e)
> {
> //SQL variables
> Object sql;
> SqlConnection cn;
> DataSet dsLocal = new DataSet();
> SqlDataAdapter da = new SqlDataAdapter();
> SqlCommand myCommand;
> SqlDataReader reader;
> //initialize the variables that handle data to be bound to
> Local table;
> Object FamilyName = txtFamilyName.get_Text();
> Object Dwelling = cboDwellingType.get_SelectedItem();
> Object DisasterType = cboDisasterType.get_SelectedItem();
> Object WorkerName = txtWorkerName.get_Text();
> Object DamageDescGeneral = txtDamageDescGeneral.get_Text();
> Object Utilities = chkUtilities.get_CheckState();
>
> //Set the connection string of the SqlConnection object to
> connect to the ARC database
> cn = new SqlConnection("Server=METZLER"+
> "Integrated security=SSPI;" +
> "database=ARC");
>
> myCommand= new SqlCommand(sql, cn);
>
> cn.Open();
>
> //convert Disaster_Type to Disaster_ID
> sql = "SELECT Disaster_ID FROM Disaster_Type WHERE
> ((Disaster_Name = " + DisasterType + " ))";
> reader = myCommand.ExecuteReader();
> While(reader.Read());
> {
> DisasterType = reader.GetValue(0);
> }
> reader.Close();
>
> //convert Dwelling_Desc to Dwelling_Type
> sql = "SELECT Dwelling_Type FROM Dwelling WHERE ((Dwelling_Desc
>
> = " + Dwelling + "))";
> reader = myCommand.ExecuteReader();
> While(reader.Read());
> {
> Dwelling = reader.GetValue(0);
> }
> reader.Close();
>
> //Initialize the SqlCommandBuilder object to automatically
> generate and
> //initialize the UpdateCommand, the InsertCommand, and the
> DeleteCommand
> //properties of the SqlDataAdapter.
> cmdBuilder = new SqlCommandBuilder(da);
>
> da.Fill(dsLocal, "Local");
>
> //convert Utilites data from text datatype to bit datatype
> If (Utilities = true);
> {
> Utilities = 1;
> }
> If (Utilities = false);
> {
> Utilities = 0;
> }
>
> //SQL statement to insert data into Local table
> sql = "INSERT INTO Local (Local_rowguid, ARC_Worker,
> Description, Disaster_ID, Dwelling_Type, Family_Name, Utilities)" +
> "VALUES (NewID(),'" + WorkerName + "', '" + DamageDescGeneral
> + "',
> '" + DisasterType + "', '" + Dwelling + "', '" + FamilyName + "', '" +
> Utilities;
>
> da.Update(dsLocal, "Local");
>
> //oleDbDataAdapter4.Update(dsDescriptionOfDamage1);
> //oleDbConnection1.Close();
> //dsLocal1.Clear();
> //oleDbDataAdapter4.Update(dsLocal1);
>
> //oleDbDataAdapter4.Fill(dsLocal1);
> //oleDbConnection1.Close();
> //oleDbConnection1.Close();
>
> //Close the database connection.
> cn.Close();
>
> MessageBox.Show("Local Detailed Damage Assessment has been
> updated.");
> }
>
> private void cmdCloseWindow_Click (Object sender, System.EventArgs e)
> {
> Close();
>