Best Approach To Login To SQL Server Express?

Mar 28, 2007

I borrowed some code from a colleague to login into SQL Server:

public static SqlConnection GetConnection()
{
string dbNameSvr = ConfigurationSettings.AppSettings.Get("DataBaseServer");
string db = ConfigurationSettings.AppSettings.Get("DataBase");
string userId = ConfigurationSettings.AppSettings.Get("UserId");
string password = ConfigurationSettings.AppSettings.Get("Password");

string connStr = "Data Source=" + dbNameSvr + ";" +
"Database=" + db + ";" +
"User Id=" + userId +";" +
"Password=" + password + ";";

SqlConnection aConn = new SqlConnection(connStr);

return aConn;
}



It works but someone has commented that it is very insecure. I don't really understand why but I'll take his word for it. So I'm wondering what approach most people use to have a web app login to their database?

Robert W.

View 6 Replies


ADVERTISEMENT

I Created A Login In SQL SERVER 2005 EXPRESS, But Cant Login...

Nov 24, 2005

create login dave with password='abc', default_database=tempdb

View 6 Replies View Related

I Can Not Login Sql Server Express :((

Mar 23, 2008

This is my connection string : <add connectionString="Data Source=.SQLEXPRESS;User id=sa;password=*******;AttachDbFilename=|DataDirectory|serdarmuh.mdf;Initial Catalog=serdarmuh;" name="connString"/>  but it says :Login failed for user 'sa'.I adjust the password for "sa" during the setup and set the authentication moded to "Sql Server and Windows Authentication Mode". But it does not work.... If I tried "Integrated Security = True", then it says :Login failed for user 'Administrator' what should I do? Is it better to re-install sql server?  

View 1 Replies View Related

VS 2008 Express, New Install: Cannot Open Database Aspnetdb Requested By The Login. The Login Failed.

May 9, 2008

Hi,
I just installed Visual web developper 2008 express with all options including SQL srvr express 2005!

This is from default iso image on the official website.

I create my first project and when I want to do ASP.NET configuration from web site menu, i got this error:

"Cannot open database "aspnetdb" requested by the login. The login failed."

I am just trying to learn here so i even did not create any dB or something, it is 1st time I run configuration to add security roles and users for testing!

I also un-installed all and re-installed, still the same...

pleas help and give me details as i am new.

kind regards,Golgot

View 12 Replies View Related

SQL Server Express For Login Control

Aug 11, 2006

I have built a page with the login control using the default sql server express database that is integrated into the application. I have got it working on my development machine and want to post it on the web with a web hosting company. I did not know if they had to have sql server express installed on that machine for my database to work properly or will it work with sql server 2005 installed. Most web hosting companies that I have called say they only support sql server 2005 and not sql server express. I was unsure if the login would work or not. Please help with this issue. I am new at ASP.net and really enjoy it. However, I want to ensure that my site will work on the web as it does on my machine.

View 4 Replies View Related

Login Failed To SQL Server Express

Oct 10, 2007

For the life of me I've had nothing but trouble using SQL Server Express.  My latest problem sprung up out of nowhere, I all of a sudden begin getting the following error, when I know my app was working last time I ran it: "Cannot open user default database. Login failed.Login failed for user 'PINCHCPUBrad'."I get this error in an auto-generated file App_Code.1voqxxpd.18.cs.  What kills me is, I can connect to the database through Server Explorer and SQL Management Studio, but for some reason my application cannot.  I really don't understand how logging-in works with SQL Server Express as I've never even set up a login.  When I look at my database properties in Server Explorer is shows Owner as the exact entity my application says it can't find: 'PINCHCPUBrad'. The database I'm trying to connect is in my App/Data folder and my Connection String says: "LocalSqlServer" connectionString="Data Source=.SQLExpress;Integrated Security=True;User Instance=False;AttachDBFilename=|DataDirectory|aspnetdb.mdf" providerName="System.Data.SqlClient"/>    I honestly don't get why attaching to and maintaining a simple database is unbelievable difficult and unpredictable, but I constantly get screwey errors like this that pop up out of nowhere. 

View 2 Replies View Related

ASP.net SQL Server Express Login Question

Aug 27, 2007

I'm attempting to connect to a SQL server database from the code behind in an ASP.net 2005 page. I am receiving the error:

"Cannot open database "Fastaff" requested by the login. The login failed. Login failed for user 'DEBASER1\Carlo'."

4060

My web.config connection string is:

<add name="FastaffConnectionString2" connectionString="Data Source=.SQLEXPRESS;Initial Catalog=Fastaff;Integrated Security=True" providerName="System.Data.SqlClient"/>

The odd thing is when I login to the the same database from the management console using windows authentication I am able to login and the connection info shows:

DEBASER1SQLEXPRESS (SQL Server 9.0.3042 - DEBASER1Carlo)

DEBASER1Carlo is the admin on the machine.

Any ideas?

View 3 Replies View Related

Cannot Login To SQL Server Express 2005

Apr 28, 2008



After a successful install, when I try to Login I get:

Cannot connect or EDHANSEN-PCSQL EXPRESS

"The initializer for 'System.Data.SQLClient.SQLConnection' Three an exception . (System Data)

'The type initializer for System.Data.SqlClient.SqlConnectionfactory' threw an exception.

'Unrecoginzed configuration section system.serviceModel.
(C/WindowsMicrosoft.NetFrameworkv.2.0.50727Configmachine.config line 136) (System.Configuration)

I've tried uninstalling and re-installing. What do you think this is telling me?

Thanks,

Ed Hansen



View 2 Replies View Related

SQL Server Express Login Failure

Nov 21, 2007

I am using and learning Visual Basic 2005 Express edtion
I have created a project and wriiten/adapted code, as below, to connect to sql server 2005 express edition, that works well.

=============================================================

Dim ConnectionString As String = "Integrated Security=SSPI;" + "Initial Catalog=JIMDbase2;" + "Data Source=.SQLEXPRESS;"

conn = New SqlConnection(ConnectionString)

' Open the connection
If conn.State <> ConnectionState.Open Then
Try
conn.Open()
Catch ae As SqlException
MsgBox(ae.Message.ToString())
End Try

End If
=============================================================

Later and in the same Project, via Database explorer I 'Add connection' to the same sql database to review tables etc.
After this when I run the same code, as above, I get an error that the database is in use

If I then 'Close Connection' or even Delete the connection via Database explorer I receive the error


"Cannot open Database, "JimDbase2" requested by the login. The login failed.
Login failed for User "..".

Can anyone help on this matter?

Thanks and regards,

Jim

View 7 Replies View Related

SQL SERVER 2005 Express Login Problems

May 5, 2006

I have two applications added to a single solution. A Web application and a ClassLibrary which contains the Unit Tests. From the ClassLibrary I am trying to open the SQL SERVER 2005 Express Database. The database is in the App_Code directory of the Web Application folder. I have added the App.config file in my class library which has the following credentials. <connectionStrings>    <add name="ConnectionString" connectionString="Data Source=MYSERVER;Initial Catalog=MyDatabase;User Id=AZAMSHARP;Password=mypassword;"/>  </connectionStrings>Now, when I run the test:   [Test]        public void CanOpenDatabaseConnection()        {            string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;            SqlConnection myConnection = new SqlConnection(connectionString);            myConnection.Open();            Assert.AreEqual(myConnection.State, ConnectionState.Open);            myConnection.Close();                 }It throws the Exception: ThingsTODOTestApps.SqlConnectionFixture.CanOpenDatabaseConnection : System.Data.SqlClient.SqlException : Login failed for user 'AZAMSHARP'. Reason: Not associated with a trusted SQL Server connection.I tried the same connectionString with the WebApps and it worked fine and displayed the results. Any ideas! PS: AZAMSHARP is my windows authentication account.

View 2 Replies View Related

Login Problems After Publishing (sql Express Server)

May 31, 2006

Thanks for taking your time to read this.(sorry if someone posted this earlier but no solutions helped)
 
After i published my website, i am unable to login anymore. It has this error of  "Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed."
Note ** im using vb
 

View 1 Replies View Related

SQL Server 2005 Express Login Problem

Nov 13, 2007

I installed express on my desktop and created a database - everything works fine. I did a backup of the database and restored it to my laptop and now when I try to connect with an application I am writing I get an error that the connection fails because the connection is not associated with a trusted connection, error code is 18454. Anyone have any ideas what I need to do?

View 1 Replies View Related

Sql Server Express Connection String And Login

Mar 12, 2007

Hi there

I'm trying to connect to sqlserver express using dreamweaver mx. TYhey are both installed on the same machine (win 2000 server),

What I am confused about is the user and password, I have installed the example Northwind database and attempting to connect to it.

In dreamweaver I add a connection (SQL Server connection) , a template shows and I add the data:

Persist Security = false;
Data Source =mycomputersqlexpress;
Initial Catalog = Northwind;
User ID = ?
Password = ?

What do I put in the User ID, Password and how do I configure sqlserver (I'm using Server Management Studio).. As I said I already have Northwind under the database section? but don't know how to set permissions.. Thanks

View 2 Replies View Related

Sql Server Express Database Login Problem

Jun 1, 2006



Hi! I'm using Sql server 2005 Express, and now i have a login problem. I want to create a user for my database in Sql Server Authentication mode, that when others that they don't know sa password and login in windows authentication mode can't see or can't access my database. I did these steps :

1. I loged in to sql server in 'sql server authentication' mode and with strong sa password

2. I went Security Logins and created new login with password

3. I went to my database security users and created new user and for login name i choosed previous login i created in step 2

4. Then i closed sql server and when i restarted it and loged in to sql server in 'Windows Authentication' mode i could see and open database.

Problem : in step 4 i wanted that i couldn't open my database.

Please help what should i did that i forgot to do ?!!

View 6 Replies View Related

SQL Server Express Initial Login Permissions

Jul 2, 2007

After installing SQL Server Express I can now connect using my Windows authentication but am unable to create a database because all BUILTINUsers only have public permissions. I don't have the sa password and there are no other users or user groups set up which I could use to upgrade my permissions. So I can't do much of anything with SQL Server.



For background, I'm setting this up on a personal laptop running Windows Vista. I'm one of only two users on the machine and I have an Administrator user account.



Any help is appreciated.

View 11 Replies View Related

SQL Server Express Client App Login / Password

Dec 18, 2006

Help!!

I used to have an Access database which had tables for users, roles, actions etc.

This was used by a C++ client app (using ADO) which logged in, got the user ID and password (by raising a login dialog ) and then checked these against a user table and then assigned the roles and possible actions.

Now we have SWL Server Express 2005 - NT Authorisation - how do I get/pass the user ID to the C++ Application so it can get the associated roles? Seems silly to have 2 logins.

Better still can I do away with the App's User table or make its password column invisible to all users bar Admin and the C++ App?

View 1 Replies View Related

How To Login To Sql Server Express By Creating You Own Account ?

Nov 21, 2007

Dear All,
I currently installed visual studio 2005. So together it als install sql server express. So then I install the sql server management studio express too. So the problem now I want to do is run asp.net pages. I want to know how to create a local account with my own password. Because now I can only login using default windows authentication so how can I create an account with for sql server authentication ? Another question is that for the server address in my asp.net page what must I write localhost or the name shown in the server name text box while logging in. Thanks.

View 4 Replies View Related

Login To SQL Server Express Using Command Prompt

Jun 30, 2006

How can I login to SQL Server Express instance(localhostSqlExpress) using command prompt so that I can query database. Is there any alternative GUI tool for SQL Server Express Manager? (I think Microsoft has discontinued SQL Server Express Manager). I prefer using Command Prompt. I am using WindowsXP Professional.

View 8 Replies View Related

Windows App Cannot Access SQL Server Express DB (login Failure)

Jul 6, 2007

I am using an unattended install script to install the database on the client machine. All the settings look correct. But my application cannot access the db -



Error: Cannot open database requested by the login.



Now when I install SQL Server Express manually, it works fine. I have the service running under local system and enabled user instances is true. I cannot figure out the problem(been working on it for 2 days).



Any ideas?



View 1 Replies View Related

Not Able To Create NEW LOGIN In SQL Server 2005 Express Edition

Nov 8, 2006

I have installed on my PC Visual Basic 2005 Express Edition which installed SQL Server 2005 Express Edition. In addition I downloaded and installed SQL Server Management Studio Express(SSME).

Now using SSME I can connect into SQL server express with the default login that was created by the installation. I want to create a new login:

Right click on Security > New > Login

I filled in all the details. However, when I click OK I get the following error:

Create failed for Login 'Mauriceewlogin'. Windows NT user or group 'Mauriceewlogin' not found. Check the name again.



Please, help. I am getting fraustrated with this error.

Thanks.

- Terhemba

View 1 Replies View Related

SQL Server Express Login Issue With Large Databases

Feb 6, 2007

Hello,

My company works with SQL Server 2005 express locally with Visual Studio to develop websites. Everything works very well.

We use SQL Server 2005 express on our production server as well. We change the database over to a non-User Instance when the site is ready to go live. Everything works fine here as well.

We run into issues when databases get near 100 MB. This is well below the stated database size limit for Express of 4GB.

At that point, about once a day, a site with a "large" database will stop responding. The error that we'll get is "Cannot open database 'DBNAME' requested by the login. The login failed. Login failed for user 'DBUSER'

The only way we've found to fix this is to restart the SQL Express service. Obviously, that isn't a very useful alternative.

Has anyone run into anything like this? Could we have some setting wrong?

Would moving to the full version of SQL Server 2005 fix this?

View 3 Replies View Related

How To Create A Login Userid And Password For Ms SQL Server 2005 Express?

Oct 30, 2007

My PC is Window XP Pro and I'm using Microsoft SQL Server 2005 Express and Microsoft SQL Server Management Studio Express.
My question is how to create a login userid and password under "SQL Server Authentication"? (as shown in http://www.findingsteve.net/print_screen.jpg)
Any tutorial about this I can read?

View 6 Replies View Related

I Can't Change My Sql Login User's Password In SQL Server 2005 Express

Jan 13, 2006

SQL Server 2005 Express keeps putting in a different password than the one I chose.  I would check the properties on the login I want to change.  Then I change the password and it gets accepted.  When I try my web application, I get the dreaded "login failed for <loginname>".  I look at the properties again and see my password never change.  Is this a bug?  I ever tried this syntax to no avail:

CREATE LOGIN <loginname> WITH PASSWORD='<mypassword>' CHECK_EXPIRATION = OFF, CHECK_POLICY = OFF

View 3 Replies View Related

Limit Client Ip To Login SQL Server 2005 Express.(compare MySQL)

Jan 10, 2007

Hi,

In MySQL,

"GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.1' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;"

This gives the permission to 'root' user from '192.168.1.1'. Another user or another ip couldn't connect to this server.

In SQL Server 2005 Express, can I implement like above query statement?

View 1 Replies View Related

Simple Test Winforms App: Login Failed For User Sa - Sql Server Express

Jan 25, 2008

I've installed sql server 2005 on a customer's machine.

I have a very small "connection tester" app C# (2005) winforms app, which I use to verify connection strings. This app has been working for years. I am using the sa account to login with in this test app just to keep things simple. I am using Sql Server Authentication.

When I try to connect, I get a "login failed for user sa". I'm absolutely certain that I have the password correct.

Sql Server Express is setup in mixed mode, and I have all the tcp/ip settings correct ( as far as I know ).

I think if it was a tcp/ip thing, it wouldn't find the machine, as opposed to saying Login Failed.

I'm running out of things to look at.

The machine has .NET 3.5 installed. The connection test was written using C# 2005, .NET 2.x Could that cause a problem?

View 3 Replies View Related

Can't Login To SQL 2005 Express Edition Through Mangerment Studio Express

Apr 29, 2007

Hi, all

I installed SQL 2005 express edition in my pc (Pro XP), then I can login from SQL 2005 Managerment Studio Express. After a few days later, I can't do it and an error message as belows:


An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)
It seems that the default setting does not allow remote connections, however, I connected it before and havn't change any setting. I try to reinstall the studio express but still not working.

Any idea / solution will be welcome.

Kevin Cheang

View 3 Replies View Related

SQL Server 2005 And Express Permissions Nightmare/Cannot Open Database ASPNETDB.MDF Requested By The Login

Apr 12, 2007

I just spent the better par of 3 days creating a prototype in ASP.Net 2.0 and SQL Server Express only to discover that nobody from outside can see it...
ERROR with impersonation=true
User does not have permission to perform this action.
ERROR with impersonation=false
Unable to open the physical file "c:inetpubwwwroot------.mdf". Operating system error 5: "5(Access is denied.)".An attempt to attach an auto-named database for file c:inetpubwwwroot-----.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.  
What makes this so difficult?
What am I missing?
 

View 9 Replies View Related

MS SQL Server 7.0 And Approach

Oct 18, 1999

Environment
NT Server 4.0 w/ SP4
SQL Server 7.0 w/ SP1
Win98 Client w/ Lotus Approach 9.5

I recently added SQL 7.0 to be a back end for my Approach front end. I transferred all the data from a dbase IV in approach to SQL. Most of the conversions worked ok. I have two big problems.

1) One particular repeat panel in Approach loses the children records of the master record. If I delete some of the records, more will appear. It's as if there is an imaginary limit of the number of records it can read in the repeat panel. I don't have this problem with any other records and children in repeat panels. I called Lotus and they don't have an answer. This is important because the children records need to be summed up so I can have a running total.

2) I original configured the clients to use the TCP/IP Netlib w/ the default port. I couldn't open enough databases so I changed to Multiprotocol. This allowed certain clients to open more databases, but others can't open additional databases. Also, after the change, the NT authentication login has had problems. I had to change to the SQL login to get all my clients back on line. Sometimes the same client can't open more than 10 databases while other times it will open 15. There is no consistent patten to when it can and can't open the additional databases.

If anyone knows how to fix either of these problems, I would greatly appreciate any advice. I'm getting tired of my boss yelling at me.

Thanks.

Keith
akumaboyz@aol.com

View 1 Replies View Related

Remote Hosted SQL Server - Approach?

Jul 18, 2007

I have been happily using RS (SQL200) on one of our local servers for some time. However, we have SQL2000 installed on a hosted, managed remote server for some applications we provide.



We need to report on the data so the obvious decision was to get RS installed on the remote machine so I could design and deploy the necessary reports from here to RS on the hosted server.



However, for various reasons (that I do not fully understand) the default install of RS does not work on the remote server and the hsoiting company won't install it in anything other than it's default dormat. So our original plan seems to be stuffed.



What are options here? It was suggested that we could 'replicate' the hosed server data to my 'local' SQL server but that seems to have hit a brick wall too.

What would I need to do to report using the 'local' RS against the 'remote' data - is this possible?

View 1 Replies View Related

Best Approach To Move Data On A Same Server

Nov 26, 2007

I have staged my tables in a database which is in the same server as the destination database and they are on sql server 2005.

Now I need to push the data from the staged table to destination.


Which is the best approach in ssis ?


1) using execute sql task to a call stored procedure to push the data to a different database using server.dbo.table name from the stored procedure.


or


2) using dataflows to call a stored procedure and map source and destination.

View 13 Replies View Related

Best Approach For Appl Development-SQL Server 2005

Apr 13, 2008

Hi,

I'm looking for some input as to "how to" create a desktop application that will be using SQL Server 2005 with the possibility of becoming a web application later.

So far I have looked at Access 2007 as a candidate to build the appropriate forms and update the SQL Server, however I'm still wondering if there is a better approach considering that this app may likely become a web app, and I should bypass Access 2007 and use some other product, and it doesn't have to be a MS product, and could be Open Source.

The SQL Server 2005 part has been loaded and works fine with the various management tools.

With that said are there any opinions on what other application(s) could be used to build the front-end as rapidly as possible and still have scalability?


Regards,

Cool Hand

View 18 Replies View Related

What's The Best Approach To Time-based Checking From App. To SQL Server?

Jan 14, 2007

Hi

I have an VB.NET application connected to a SQL Server Express. I want to let the application to run in either "Normal mode" or "Holiday mode" according to current weekday is normal day or state public holiday.

My approach is to find out all the public holidays in a year and enter them into a Holiday Table. Then some code in my application constantly check the current weekday against the one in the holiday table, if matches, the application goes into holiday mode.

This approach is not perfect as "State public holidays" are confirmed by the state government in the current year and the coming year. So state public holidays are unconfirmed for the third year afterward. The system is required by client to support public holiday in the next 10 years.

I wonder what is the best approach to this problem?

Thanks

View 5 Replies View Related

NH: Best Practices Approach - Call Stored Proc - Or Run It Via Linked Server?

Mar 27, 2007

what pro's cons would there be to having a linked server run a local stored proc against another sql server or create that stored proc on that other sql server and call it from there in the c# code.
i would think that calling the stored proc would be more efficient that running a linked server - but please let me know your thoughts. I'm not sure i can have permission to add a stored proc on that server, so possibly the linked server is the only solution - but if i can put a stored proc on that server should i?
thanks.
Jeff 

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved