Is This The Correct Coding To Connect To Sql Server For Login Page?

Jan 28, 2008

 Partial Class Default3

    Inherits System.Web.UI.Page



   



    Protected Sub Login1_Authenticate(ByVal sender As
Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs)
Handles Login1.Authenticate



        Dim cmd As New SqlCommand

        con6 = New
SqlConnection("Server=localhost;UID=sa;PWD=XXXX;Database=knowledge;integrated
security=sspi")

        con6.Open()

        cmd.CommandText = "select
Status from usr where Uid='" & txtUsername.Text & "' and
Pass='" & txtPassword.Text & "'"

        cmd.Connection = con6



    End Sub

End Class

View 2 Replies


ADVERTISEMENT

ASP Page To Connect To SQL Server - Please Help

Jun 16, 2006

I don't know if this is the right forum or not, but it seemed like it might be the most appropriate, sorry if it is not:I am learning about websites and I have a database that was created in access and then converted to sql server and is going to be hosted on a windows server running sql server 2000.  I want to make a basic query so if I wanted to search for say buildings, I could retrieve everything in the buildings column, or if I wanted to do a seach for empire state building, I would get all hits displayed.What type of connection string would I need to use?  Do I have to configure the database itself at all?Any help would be greatly appreciated, I am a complete novice with this type of stuff.

View 1 Replies View Related

How To Connect To Sql Server As Other's Window Login Rather Than User's Window Login Thorugh ASP.NET.

Dec 14, 2006

Dear members,

In MSDN, it says that it is recommended to use windows authentication to connect to SQL Server rather than use mixed authentication.

I create user deltasqluser on windows OS, and I specify in my webform ASP.NET script below :

protected System.Web.UI.WebControls.Label Label1;
private string _connString = @"data source=deltasql2000;initial catalog=northwind;integrated security=false;user id=deltasqluser";
/*
comment : I login to my windows as deltakoronx, and I want to every user (including me), connected to sql server through IIS, will be identified as deltasqluser not as user's login (impersonate)
*/
private void Page_Load(object sender, System.EventArgs e)
{
SqlConnection conn = new SqlConnection(_connString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select suser_sname()";

conn.Open();


string userName = cmd.ExecuteScalar() as string;
conn.Close();
conn.Close();
Label1.Text = userName;
}


at web.config, I add :
<identity impersonate="false" userName="deltasqluser" password="" />


at IIS webApplication1's properties, tab "Directory Security", at "Authentication and access control" section, I checked "enable anonymous access" with user : DELTAIUSR_DELTA and checked "Integrated Windows Authentication",


at query analyzer, I login as "sa" and execute script below :
exec sp_grantdbaccess 'deltasqluser','northwind'


when I run the ASP.NET script, error at conn.Open(); with error message :
Login failed for user 'NT AUTHORITYNETWORK SERVICE'.


What should I do so that IIS login to SQL Server as user deltasqluser not as "NT AUTHORITYNETWORK SERVICE" ?

Regards,

Koronx

View 1 Replies View Related

Login Failed To Connect To SQL Server

Feb 9, 2006

Hi all,For testing purposes I created a local database using SQL Server 2000. I want to connect to this database using following code:mySqlConnection = New SqlConnection("server=(local)SQLExpress;Integrated Security=SSPI;database=TestDbInge;UID=IVANSARK;PWD=test") mySqlCommand = New SqlCommand("SELECT Voornaam FROM Personen", mySqlConnection) mySqlConnection.Open() I'm getting the message below: System.Data.SqlClient.SqlException: Cannot open database "TestDbInge" requested by the login. The login failed. Login failed for user 'IVANSARKASPNET'. It's the same when I don't add the userid and password part to the connectionstring.
What am I doing wrong?? And where does "IVANSARKASPNET" come from? Shouldn't I be anonymous? Please help.Regards, Inge

View 2 Replies View Related

Pls Help: Can't Connect To Server - Login Fails

Jul 20, 2005

I get the following error when trying to create an Access Data Project:Login failed for user 'myname'. Reason: Not associated with a trustedSQL Server connection.I'm using a specific username and password. The sQL Server (actually, MSDE)is installed on \server1, and I'm working on my laptop.I get the error whenI try and click the dropdown for "Select the database on the server". Anyhints on what I've donw wrong?Thanks, in advance.

View 1 Replies View Related

Can't Connect To SQl Server 2005 With Sa Login

Jun 29, 2007

Hello,

I recently installed SQL2005 and SQL2000. I only created SA login permissions with Admin access to the database (There are no Windows Users that have access).

I then installed SQL2000 and it overwrote the "mixed connection mode" . whenever I try to connect with the sa login I get the following error

Login failed for user 'sa'. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452)

The problem is explained in a fix http://support.microsoft.com/kb/269587

The only problem is that the fix requires access rights that I don't have. My only logins are "BuiltInUsers" that have public access rights and then a "sa" login (that doesn't work) that has Admin rights within the db engine.

So my question is... Can I create an sysadmin account with windows authentication (for a normal Windows Admin Account) without having the proper rights within the database engine?

-Tom

View 1 Replies View Related

Cannot Connect To Server - Login Failed

Sep 17, 2015

I have been using SQL Server 2012 developer edition for quite a while without problems. But now when I try to connect I get this error:

Cannot open user default database. Login failed.
Login failed for user 'D8700Ken'. (Microsoft SQL Server, Error: 4064)

I suspect that I caused this problem myself but I don't know how to recover from it. Here is what I did:

1: Used SSDT in Visual Studio to change the set default database from 'master' to 'DTNSQL' (My first SSDT experiment!)
2: Used SQLSMS to rename the 'DTNSQL' database to 'DTNSQL01'.
3: Logged out of SQL Server - then tried to log back in.

I have read that the solution to this problem is to "login using another Login."

I don't seem to have "another Login". How to find an existing Login or create a new Login.

View 3 Replies View Related

Login Page Just Refreshes With ASP.NET 2.0 Login Control

Dec 7, 2006

I am try to login using the ASP.NET 2.0 Standard Login Control. When I enter the correct userId/Password and hit the Login button, the page just refreshes, no error is displayed. But if I enter wrong userid/password..it give me an error.

Also I check the Membership.ValidateUser() returns true, that means the user is validated, but still I am able to redirect to ReturnURL.?

Is there something wrong with the Authentication, or Creating a cookie. Can somebody shed some light on this,

I have the following machine configuration

Windows XP Pro Service Pack2
IIS 5.1
SQL Server 2000
Visual Studio 2005
DISABLE ANONMYOUS ACCESS IN IIS
ENABLE WINDOWS AUTHENTICATION

I am getting the following output :

Membership.ValidateUser(Login1.UserName, Login1.Password) : - True
HttpContext.Current.User.Identity.Name : - // is blank
User.Identity.IsAuthenticated :- False
User.Identity.AuthenticationType :- // is blank

NOTE : The applicationName is same in web.config as well as in the aspnet_Applications table in SQL Server 2000 membership database.

View 1 Replies View Related

Seeking Correct Syntax To Pass A NULL Value For A Datetime Field From An Asp Page To SQL

Jan 13, 2006

Hello,I've been searching the web for quite some time to resolve the problemof "1/1/1900" returning in a datetime field in SQL that resulted from ablank (not NULL) value being passed to it through an ASP page.The solution is that a NULL value needs to passed to SQL from ASP.Thats fine...I understand the why the problem is happening and thesolution around it. HOWEVER, I can't seem to get the proper syntax towork in the ASP page. It seems no matter what I try the "1/1/1900"still results. Below are a few variations of the code that I havetried, with the key part being the first section. Does anyone have anysuggestions?!?!?______________cDateClosed = ""If(Request.Form("dateClosed")= "") ThencDateClosed = (NULL)end ifsql="UPDATE rfa SET "&_"dateClosed='"& cDateClosed &"', "&_"where rfaId='"& Request.Form("RFAID")&"'"_____________________________cDateClosed = ""If(Request.Form("dateClosed") <> "") ThencDateClosed = (NULL)end ifsql="UPDATE rfa SET "&_"dateClosed='"& cDateClosed &"', "&_"where rfaId='"& Request.Form("RFAID")&"'"_____________________________cDateClosed = ""If(Request.Form("dateClosed")= "") ThencDateClosed = NULLend ifsql="UPDATE rfa SET "&_"dateClosed='"& cDateClosed &"', "&_"where rfaId='"& Request.Form("RFAID")&"'"_______________Thanks in advance!!!!

View 7 Replies View Related

Trying To Connect To SQL Server, But User Login Failed

May 10, 2006

Hi everyone,
I am trying to open a connection to my SQL Server via ASP.NET(VB.NET), but I get the following error message:Server Error in '/test' Application.
--------------------------------------------------------------------------------

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

Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'sa'.

Source Error:


Line 92: 'Put user code to initialize the page here
Line 93:
Line 94: SqlConnection1.Open()
Line 95: If SqlConnection1.State = ConnectionState.Open Then
Line 96: Label4.Text = "SQL Connection is open"


Source File: c:inetpubwwwroot estWebForm1.aspx.vb Line: 94

Stack Trace:


[SqlException: Login failed for user 'sa'.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction)
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
test.WebForm1.Page_Load(Object sender, EventArgs e) in c:inetpubwwwroot estWebForm1.aspx.vb:94
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032
 
The account itself works fine, I am able to log in to the server successfully, for example there are no problems when I use the same user name and password for the Query Analyzer.
What could be the cause of the error mentioned above?

View 2 Replies View Related

Can't Get A Subreport To Start On The Correct Page Or Table Header To Repeat On Multiple Pages

May 24, 2006

I am staring to lose my mind on all this "work-around" BS in trying to create a dynamic header.

I have a report with contains a table, whose first two lines are a header line in which I want to repeat on each page. Then I have about 20 detail rows of information related to the header. The 21st detail row is a merged cell that contains a subreport relating to the header item.

When printing to PDF, the detail rows consume about half the page and the subreport is anywere from half a page to several pages long. When the subreport is more than half a page, it skips the end of the first page and starts on the top of the next page, leaving the bottom half of the first page blank. No matter what I set the page breaking to, it continues this behavior. In addition, when the subreport data spans more than one page, my parent table's header row will not print to the next page even it the RepeatOnNewPage is set to true.

I am coding this way because I have found no good way of creating a dynamic header that will correctly and consistantly display data that has detail that spans more than one page.

Any thoughts on what I might be doing incorrect?

View 6 Replies View Related

.NET Framework :: Could Not Connect To Server - Login Failed For User

Jul 20, 2015

I am trying to create a CLR project in my Visual Studio 2010 with SQL Server 2012. I can build my empty project succesfully, but if I try to deploy it, I get such an error...Beginning deployment of assembly SimpleCLRIntegrationNew.dll to server xxxxxxxxx : di_test

C:Program Files (x86)MSBuildMicrosoftVisualStudiov10.0TeamDataMicrosoft.Data.Schema.SqlClr.targets(96,5): error : Could not connect to server "xxxxxxxxxx: di_test": Login failed for user 'di_test'..

View 2 Replies View Related

Login Failure - Unable To Connect To Server Using Windows Authentication

Aug 12, 2015

We have see login failures for windows accounts. Below is the error message.

Description: In our env most logins are windows accounts. Initially we thought it is an UAC issue and we tried to launch the SSMS using "Run as Administrator". However, we are seeing login failures.

Enviroment:
Microsoft SQL Server 2014 - 12.0.2402.0 (X64)
RTM Enterprise Edition (HyperVisor)

Error Message in Error Log :

2015-08-10 22:36:45.290 Logon Error: 18456, Severity: 14, State: 11.
2015-08-10 22:36:45.290 Logon Login failed for user 'domainloginname'. Reason: Token-based server access validation failed with an infrastructure error. Check for previous errors. [CLIENT: 10.xxx.xxx.xxx]

[code]....

We tried dropping this account and re-creating the windows account with same permissions but still result is same. It throws same error message. Login failure message !!!

View 9 Replies View Related

Using SSIS Package To Connect A Remote Sql Server--login Failed.

Feb 13, 2006

Hi,

i created a SSIS package to import data to a remote sql server, using the following connection string:

"Data Source=My-SQL;User ID=PortalUser;Password=Password;Initial Catalog=TestOMIWarehouse;Provider=SQLNCLI.1;Auto Translate=True;";

and got an error "Login failed".

When i give PortalUser a sysadmin server role, it works. But i don't want to give PortalUser a sysadmin role. Any suggestions? Is sysadmin role required to access a remote server using Sql server authentication?

thanks! Any help would be appreciated.

alea



View 4 Replies View Related

SQL Security :: Using Contained Database Login To Connect To Server Via Excel

Jul 29, 2015

I have a SQL Server 2014 database that is partially contained.  I am trying to connect to the database via Excel using a contained user login.  When I choose Data - Other Sources - From SQL Server, I get the Data Connection Wizard window to Connect to the Server.

This window allows me to enter the server name and a User Name and Password (for SQL authentication), however it does not allow me to specify a database.  When I click the Next button, I get a 'login failed' error which I assume is happening because the contained user is not a SQL login.

I have the same issue trying to create an ODBC connection using the ODBC Data Source Administrator. 

Is there another way for me to connect to a SQL Server database using a contained login with Excel? 

View 10 Replies View Related

Connect 2 DropDownList And Received Input String Was Not In A Correct Format

Jul 26, 2007

I have 2 DropDownList, the first one to display the product category and the other one to display the products based on the selected category. However, when I run code I received the following error message: Input string was not in a correct format.
Please find the code below.
Thanks,
Andy.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server"><title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1"
DataTextField="Name" DataValueField="Name">
</asp:DropDownList>
 
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Assignment2ConnectionString %>"
SelectCommand="SELECT [Name] FROM [Category]"></asp:SqlDataSource>
<br />
 
<asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="SqlDataSource2"
DataTextField="Name" DataValueField="Name">
</asp:DropDownList>
 
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:Assignment2ConnectionString %>"
SelectCommand="SELECT [Name] FROM [Product] WHERE ([CategoryID] = @CategoryID2)">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="CategoryID2" PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
 
</div></form>
</body>
</html>

View 1 Replies View Related

Login Page

Sep 27, 2007

Hi,i created my own table.it includes usr_name,usr_surname,usr_email,usr_passwordand i have login form.it includes 2 texboxes.1 for login(email) and the other for password.How can i query the user on database if user on db and his password matches with his username.dont advice me to try asp.net membership please..i want to create my own.i am using sql,asp.net codebehind:vb.if you give example with stored procedure it can be more useful for me.thanks,

View 3 Replies View Related

Login Page Using SQL DB

Jan 18, 2004

I apologize because this question is probably so amazingly simple it sounds retarded, but I am a 100% newbie to ASP.NET --

I am using WebMatrix to create an ASP.NET login page (coding in VB), and I have a SQL server with a table in it called "LoginInfo". That table has three fields, "PrimaryKey", "UserID" and "PIN".

Basically, the goal is that the user goes to the page and enters their UserID and PIN into two different boxes and then pushes a button and it logs them into the page. My problem is, I have the UserID/PIN text boxes, I have the button, I have the SQLDataConnection (I just dragged the table from the Database onto the page and it made it for me), but I don't know what to do at all now.

How do I have the UserID text box check against the UserID's pulled from the table in the SQL server, and how do I have the PIN numbers check against the PIN numbers pulled from the SQL table, and then if they match up let the user into the site?

I'm sorry if this is a lengthy question to answer or if it is so simple its irritating, as I said I am a complete newbie.

View 3 Replies View Related

Obtaining Login ID From Page

Oct 3, 2006

Hello,

By using DBCC Page I am able to exemine data entered to row and other changes related to the rows. What I want to know is; is it possible to find out (and how) which Login ID commited these change directly from pages or where do I need to look to find it out?

Any guidance is appreciated....

View 1 Replies View Related

Login Failed For User 'NT AUTHORITYANONYMOUS LOGON' (but User.identity.name Is Correct)

May 1, 2007

I need help.  The security principal is the correct DomainUser, but the error message says I am not authenticated.
So here is my error Message:
Login failed for user 'NT AUTHORITYANONYMOUS LOGON'. Me.User.Identity.Name=CompanyDomainRyan; System.Security.Principal.WindowsIdentity.GetCurrent=CompanyDomainRyan; HttpContext.Current.User.Identity.Name=CompanyRyan
Generated by:
Dim secPrinc As System.Security.Principal.WindowsIdentity = System.Security.Principal.WindowsIdentity.GetCurrent
Me.lblError.Text = ex.Message & vbCrLf & vbCrLf & "Me.User.Identity.Name=" & Me.User.Identity.Name & "; System.Security.Principal.WindowsIdentity.GetCurrent=" & secPrinc.Name & "; HttpContext.Current.User.Identity.Name=" & HttpContext.Current.User.Identity.Name
Here is the Connection String:
Private ConnString As String = "Server=10.144.162.111;Database=DNS;Trusted_Connection=True"
 
IIS has 4 websites hosted on it.  The parent level allows anonymous with windows auth off, but the website level has anonymous off with widnows auth and digest.
In IIS, is there a problem with having the parent level anonymous and website level windows auth?

View 1 Replies View Related

How To Connect To A DB Multiple Times Through Page

Dec 21, 2007

Hey all,
I am still pretty new to all of this and I am having problems accessing a the same DB twice in my page.  I want to pull information once in one spot, but then pull different information in a different spot on the page.  Anyway, in the first spot, I have the following code:
Dim conString As String = WebConfigurationManager.ConnectionStrings("DataConn").ConnectionString
Dim con As New SqlConnection(conString)Dim cmd As New SqlCommand("Select Team1.TeamID as Team1ID, Team1.TeamName as HomeTeam, Team2.TeamID as Team2ID, Team2.TeamName as AwayTeam, Football_Schedule.ScheduleID as ScheduleID from (Select * from Football_Teams) as Team1, (Select * from Football_Teams) as Team2, Football_Schedule where Football_schedule.team1 = Team1.teamid AND Football_Schedule.team2 = Team2.teamid order by Football_Schedule.WeekNum, Team1.TeamName, Team2.Teamname", con)Using con
con.Open()
Dim RS As SqlDataReader = cmd.ExecuteReader()
While RS.Read()
blah blah blah
End While
End Using
 
Then in my other spot on the page I have the following:
Dim cmdresults As New SqlCommand("Select Users.Firstname, sum(PointsID) as TotalPoints from Football_Input, Football_Schedule, Users where Football_Input.TeamID = Football_Schedule.winID and users.userid = Football_Input.UserID Group by Users.firstname")
Using con
con.Open()Dim RD As SqlDataReader = cmdresults.ExecuteReader()
While RD.Read()%>
<tr>
<td><%=RD%>
</td>
</tr>
<%End While
End Using
 When I try to execute I get this error, "ExecuteReader: Connection property has not been initialized." on the following line, "
RD As SqlDataReader = cmdresults.ExecuteReader()"  Any ideas?  If possible a little explanation on how multiple connections to the same database work would be nice just for future reference.
Thanks in advance!!,
Chris

View 5 Replies View Related

Forms Authentication --&&> Redirect To Login Page

May 8, 2008

We've successfully set up SSRS with forms Authentication (yea - wasn't easy!)

If we browse to the default web site, we get the login page. Once we authenticate, we can move around the site and run reports.

If however, we try to access a page (other than the login page) while we're not authenticated we get an exception instead of being redirected to the login page:

Object reference not set to an instance of an object

Microsoft.ReportingServices.UI.GlobalApp.Application_AuthenticateRequest(Object sender, EventArgs e)

If we set the Reportmanagerweb.config file to use Windows authentication, we get a 401 Access Denied page instead.

My first inclination would be to override the Global.asax file for SSRS, swallow the exception and redirect to the Login page. Not sure how to do this since the Global.asax.cs page isn't in the folder (I assume the compiled version hidden away somewhere).


It's not just the intial login either, timeouts are especially frustrating because, instead of being redirected to the login page, the users get the exception.

Any idea what might be causing the exception in the first place?

Thanks!
Mike

View 1 Replies View Related

Login Failed For User 'sa' ,connecting From Asp.net 2.0 Page

Mar 4, 2008

Hello,
i am using sql server 2005 and installed in mixed mode withe user name sa and password #sa
and from Sql Server Surface Area Configuration i select the Using both TCP/IP and named pipes for remote settings under Database Engine
version is [@@version]
Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86) Oct 14 2005 00:33:37 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Evaluation Edition on Windows NT 5.1 (Build 2600: Service Pack 2)

My os is Xp with service pack2

I am using asp.net 2.0 and using connection string in web.config
<configuration>
<appSettings>
<add key="brian" value="server=SOURAV;uid=sa;pwd=#sa;database=test"/>
</appSettings>

SOURAV is my local Database Server name.

I can connect server with the user name password from the SQL Server Management Studio,
But the problem arise when i hit con.open() from asp.net page

error message show login failed for user 'sa'

Please help how to solve,
Thanks in advance
Sourav

View 1 Replies View Related

SQL Server Best Practice Analyzer And T-SQL Coding Standards

Jul 23, 2005

Does anyone know much about this tool? Also, if anyone can point me toa TSQL coding standard, please let me know.-- Dave

View 2 Replies View Related

Need Coding For Inserting Data Into SQL Server Using Stored Proecdure.

Dec 19, 2007

Hi to all..
I am new to ASP.Net, I want coding for inserting data in to SQL server 2005 that code contain the following criteria.
  1.ASP.Net using C#.Net.
  2.Using Stored Procdure.
  3.the connetion string ,command , Data reader is in the same class. this class will be reusable for other page also without modifying any thing in it.
Please Help me.
  Advance thanks.

View 2 Replies View Related

SQL 2005: Symmetric Encryption With Asp.net Page, Login, Username, Password

Nov 29, 2007

I currently have a login page in asp.net 2.0 linked to a SQL 2005 database table that holds the usernames and passwords. At present, I am on an "honor system" where I do have access to the passwords of the other users but would like to change it so that I cannot know what the users' passwords are. Thank goodness that there is no personal information within the pages and the logins were created to keep a log of who logs in and what not. However, I would like to soon hold more personlized information, hence the need to encrypt each user's password even from myself.
I have read up on Symmetric Encryption for SQL 2005 but I would like to know if there is anything else available, any good proven methods that someone else has already tried.
Also, while testing out Symmetric Encryption, I noticed that I have to supply the encryption password for the decryption. However, if I know what the password for the encryption/decription is, does it not defeat the purpose of having the encryption at all, in terms of the "Admin" having access to sensitive information? Just curious if I understood the concept correctly or not.
 Thanks in advance to all.
 
 

View 2 Replies View Related

SQL Server 2012 :: Alter Query To Avoid Hard-coding?

May 25, 2015

using below query to raplace the string values (REPLACE abc with T1223), how to use the query without hard coding.

i want to store the values in another temp table and access in main query.

'abc', 'T1223',
'def', 'T456',
'ghi', 'T789',
'jkl', 'T1011',
'mno', 'T12'
select id,name,
LTRIM(RTRIM(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(name,
'abc', 'T1223'),
'def', 'T456'),
'ghi', 'T789'),
'jkl', 'T1011'),
'mno', 'T12'))) New_id
from TAB

View 4 Replies View Related

Help! Cannot Connect To Database, Login Failed..

Jan 31, 2008

Help! Cannot connect to Database, login failed for user...
I have been looking for a fix for this for some time, however I have yet to find one. I am running msde-2000 and I have a programm that I wrote with VB.Net 2003 that works fine when I am in Debug Mode, however when I deploy the application, and try to connect to the MSDE SQL-Server I get an error that states, "Cannont Connect to database TCON1, Login failed for user Amanda,

Please someone help!...

Thanks,

View 5 Replies View Related

Can't Connect Using Sa Login And Don't Have Any Other Administrator Logins

Apr 23, 2007



I connected successfully in SQL Server Management studio using the 'sa' login and changed the authentication mode to Windows NT because I could not connect using my windows login but now I can't get any connection at all because 'sa' is no longer trusted.



I changed the loginmode registry setting to 2 and rebooted my PC but this has made no difference.



Can anyone help me get the 'sa' login back?

View 6 Replies View Related

Error At Login Page: Conversion Failed When Converting From A Character String To Uniqueidentifier.

Jan 5, 2008

Hello,  Im Getting an error (below) at the login page. The only control on
that page is a Login control, adn the error below comes when I click login. Does anyone know what Im doing wrong? This is my login page:<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" Title="myapp- Login" %><asp:Content ID="Content1" ContentPlaceHolderID="ContentHeader" Runat="Server">    LOGIN</asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="ContentBody" Runat="Server">    <table border="1" cellpadding="0" cellspacing="0" width="305">        <tr>            <td class="bodyText" colspan="2" style="height: 20px; text-align: center;">                <p>                    <!-- TemplateBeginEditable name="mainText" -->                    &nbsp;<asp:Login ID="Login1" runat="server" TitleText="Existing Users Log In">                    </asp:Login>                </p>            </td>        </tr>        <tr>            <td style="text-align: right">                <asp:LinkButton ID="lbNewmembers" runat="server" OnClick="lbNewmembers_Click">New Member?</asp:LinkButton></td>            <td>                <asp:LinkButton ID="lbForgotPassword" runat="server" OnClick="lbForgotPassword_Click">Forgot Password?</asp:LinkButton></td>        </tr>    </table></asp:Content>Error: 
Server Error in '/myApp' Application.


Conversion failed when converting from a character string to
uniqueidentifier. Description:
An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error and
where it originated in the code. Exception Details:
System.Data.SqlClient.SqlException: Conversion failed when converting from a
character string to uniqueidentifier.Source Error:



An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace:



[SqlException (0x80131904): Conversion failed when converting from a character string to uniqueidentifier.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +859322 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +736198 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1959 System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +31 System.Data.SqlClient.SqlDataReader.get_MetaData() +62 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +903 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +122 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) +62 System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +1121 System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +105 System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved) +42 System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +83 System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +160 System.Web.UI.WebControls.Login.AttemptLogin() +105 System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +99 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35 System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102

Version Information: Microsoft .NET Framework Version:2.0.50727.312;
ASP.NET Version:2.0.50727.833

View 1 Replies View Related

Cannot Connect To Database: Login Failed For User

Jun 16, 2006

Hello everyone,When I try to connect to database I get this error message: Login failed for user 'databaseadmin'.My connection code is:Dim MyConnection As New SqlConnection( _
            "server=(local); database=news; UID=databaseadmin; PWD=111111;")I've tried "server=localhost:3066", and "server=." and many many other ways, but it's still not working! I don't know what other things should I try now... I asked  the support people of my web host, and their answer is:"Mysql database usename and password is corect one. It seems that there is problem with the script code."Please would anybody help me with this? Thank you very much!

View 4 Replies View Related

Login Without Connect Permission Somehow Managed To Become Db_owner!?

Jan 9, 2007

I tried asking the same question in other forum but couldn't get an answer.

I used exactly the following SQL to create a login with sa account in SQL2k5 Management Studio:
Create Login yy With Password='yy123Z'

Without granting any permission, straight away, i log out sa and login as yy in management studio, yy somehow can access one of my ApplicationDatabase! So i check with the following SQL in my ApplicationDatabase:
IS_MEMBER('db_owner')
and it returns me 1, meaning yy is db_owner. I then quickly login as sa and double check on the security|login|yy|properties|User Mapping, NONE of the database is mapped! and i also ensure "Guest account enabled for: ApplicationDatabase" is unchecked.

What could be the problem i am facing? the purpose i create yy is to ONLY allow it to have connect permission on my SQL Endpoint. Please HELP!!

View 15 Replies View Related

Can Create Login But Cannot Connect (sa Doesn't Even Work Also)

Jan 19, 2006

Hi,

Please direct me to the right forum if this is not the right one.

Upon installation of SQL Server 2005, I opened the SQL Server Management Studio, connected using Windows Authentication and went to the security node in the tree. I created a log in called "TestLogin". I restarted my server just to make sure everything took and when I tried to log in using TestLogin via SQL Server Authentication, I get the below error. I have mixed mode enabled as well as named pipes. I am not sure what the issue is or what to try next. I even get the same error when trying to use "sa".

Thanks,

- Joel

TITLE: Connect to Server
------------------------------

Cannot connect to TestServer.

------------------------------
ADDITIONAL INFORMATION:

A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) (Microsoft SQL Server, Error: 233)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=233&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------

View 3 Replies View Related







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