Passing UserName To SQL
Jul 8, 2007
A beginner's question I'm sure. When visitors have logged into my site, how do I then use their UserName as a parameter in an SQL WHERE clause so that I can pull up their detailed information. I'm using VB if additional code is required.
Thanks in advance.
View 2 Replies
ADVERTISEMENT
Oct 11, 2006
I have successfully Create a Site, Inserting Updating and
Deleting information in my DB all with Stored Procedures, But I need the
ability to pass their username into my Stored Procedures. How and where do I
code this in my ASPX file?
My SP would be something like this
Create procedure test
@UserName
varchar(50)
As
Select *
From table
Where username
= @username
All of the
data is tied to the user in one way or another but I do not know what code to
put in my page?
View 2 Replies
View Related
May 31, 2007
(I asked this question in another forum, but think it may be more of asql question)Hi.I bet this is a 101 question, but i'd appreciate any help!I am in the 'where...' section of the configure data source wizzard .(Visual Studio 2005) Column:(From my table) I select 'UserName' from drop-downOperator: I select '=' from drop-downBUT how do I get the UserName (The user is signed into the app) to pass to the where clause?Is it from the Form? Profile? Session?Ive tried Form.Page.User.Identity.Name.ToString; Form.NamingContainer.Page.User.Identity.Name.ToString; Profile.UserName; NOTHING works. IF I set the default value to a user name (eg joe_user) it retrieves fine, but I need it to retrieve for the currently signed in user. THANKS In advance.... Dan
View 7 Replies
View Related
Jun 2, 2014
I put this together to export the user name /password to a csv file to test my SP to output the user name/password.
DECLARE @user_name varchar(50)
DECLARE @psswrd varchar(10)
SELECT @user_name ,@psswrd
FROM ngweb_bulk_enrollments
EXEC master.dbo.xp_cmdshell 'bcp NGDevl.dbo.ngweb_bulk_enrollments out C: est.csv -Sserver1 -T -t, -r
-c'
This works but I don't get the headers in the file. How can I include the headers?
View 7 Replies
View Related
Feb 21, 2002
Hi!! I use nt groups to give access to users. I need to now the name of the user who is connected to a especific database.
I tryed with suser_name() function but it returns null value because ntgroups are used.
if someone now any function that can help me, i will appreciate your help.
Thanks.
View 1 Replies
View Related
Jan 26, 2008
I just installed SQL 2005 Server. I am using SQL Server 2005.
Why do I have to login with the username with "sa"?
I failed to sign in with other usernames.
What is the trick?
Thanks
View 3 Replies
View Related
Oct 4, 2005
I built an eommerce site on my local computer at work. It's now time to
put the site on our server and get things rolling... anyways, I'm
trying to perform an sqldump so I can gather the appropriate text files
so I can upload the database. Anyways, the sqldump program I am
using requires a username and password to access the sql database.
I am using MSDE and have no clue as to what the username and password may be....
My VisualStudio .Net automatically connects when I work on the site.
Does anyone know what the default username and password may be or what my options are to get this sqldump to work?
Any help would be appreciated.
View 2 Replies
View Related
Jul 10, 2001
Hello out there in SQL land! I'm writing a T-SQL script to create tables and grantlogins to local machine NT accounts. The problem is that I'm sending this script out to about 1700 machines with 1700 different DomainNames!
So hard-coding the domainusername is NOT an option. In other words, non-networked computers. In the T-SQL command:
EXEC sp_grantlogin [DomainUsername]
-OR-
EXEC sp_grantdbaccess [DomainUsername]
note: Domain= @@SERVERNAME
Username = Jib
I want to have a variable of some sort pass the DomainName & concatenated username in order to grant login the SQL Server for the NT user. Any help would be greatly appreciated.
Thanks!
View 1 Replies
View Related
Aug 1, 2006
hey can anyone suggest me how to write the efficient( a bit faster) stored proc to generate alternative usernames( with logical variations like the one of hotmail ) if provided one is already present in database... :)
View 5 Replies
View Related
Dec 13, 1998
how do you send SQL Server the proper username and password in ASP Scripts?
So far, I have: Connection.Open "DSN=DSNname;pwd=password"
Where does username play in all this and what is its format.
Appreciate any help....
View 2 Replies
View Related
Aug 9, 2004
Hi everybody,
Here the environment is application in 3 layers.
So the user in his client machine, access the application in an application server that sends the request to my sql server database server.
My problem is: when I run sp_who from Query Analyzer, I see the host name that is pre-defined inside code application. But, actually, I need to know the user who is requesting the transactio so I can know right the person who is slowing my database performance....
Do you know, any function, procedure or anything else that I can use in the application code in order to provide the user or the host name from the client machine?????
I hope some answers...
Thank you all,
View 7 Replies
View Related
Jan 6, 2005
Hello
Currently, I am using a varchar "UserName" as a primary key instead of an Identity or GUID.
System Info:
When user's sign up they provide the "UserName" that is used as a PK.
Creating a message board type web application.
UserNames will never change.
UserNames are used extensively as FK's in other Tables.
We want to scale well.
Does anyone know the implications?
I understand Joins are faster on numerical values than strings but we will not be performing many joins.
In my case is it better to use Identity as a PK or is it better to use a varchar for a "Users" table?
Thanks
jenn
View 1 Replies
View Related
Apr 25, 2008
Hi all,
I want create a trigger that will log all modification to a table.
I need to identify the username that modified the data.
Here is my problem :
- they are connected to a Terminal Server so stationName il always TSName
- They are using an application I cannot modify that always use the same login information using SQL authenticationMode
So I need to be able to get their Windows session Username.
Is there any way I can do that in my trigger ?
Thanks
View 5 Replies
View Related
Apr 22, 2006
Hi, I hope this is the right place to post this. I am pretty much stuck but think I am doing pretty good so far as I am getting more and more into SQL
using SQL Server 2000 here.
I want to be able to get the last username who replied to a topic. The "DateOfLastReply" works great, it gives me the last date of a reply to a topic so pretty much along with this, I want to get who it was that replied last. Any ideas? so far, I have this but it isnt correct:
SELECT Threads.[ID] 'ThreadID', ThreadName, DateOfCreation 'DateCreated',
(SELECT TOP 1 DateOfReply FROM Replies WHERE Replies.ThreadID = Threads.[ID] ORDER BY DateOfReply DESC) 'LastReplyDate',
(SELECT TOP 1 e.Username FROM Replies, Threads WHERE Replies.UserID = e.[ID] AND Threads.[ID] = Replies.ThreadID AND Threads.ThreadStarterUser = e.[ID] ORDER BY DateOfReply DESC) 'LastUserReplied', --HERE
(SELECT COUNT(ReplyID) FROM Replies WHERE ThreadID = Threads.[ID]) 'NumberOfReplies',
e.username 'UsernameCreator'
FROM Threads
INNER JOIN Users e ON
e.[ID] = ThreadStarterUser
View 6 Replies
View Related
Jul 11, 2007
VB ASP.NET 2.0
How do I get the Authenticated UserName passed to a Select Command of a data control ?
I'm not clear on how to get the logged in username from User.Identity.Name as a string or how to pass it to the Select Command of a control.
I've had some success with SelectParameters / ControlParameter's in the Master Control context, but otherwise I don't understand how to create a Parameter for use with the SQL.
I want to show the user data from a database, based on who is logged in .
Help, greatly appreciated.
Chris
View 8 Replies
View Related
Aug 16, 2004
how can i change the username of SQL Server 2000 from sa to another username?
thank you for the help and for the time
View 7 Replies
View Related
Jan 1, 2005
Hi,
I have installed MSDE using the following parameter:
commandline> setup SAPWD="MySAPwd"
now all was set up... when i opened the osql utility..i wasnt able to login... it kept asking me the login name ans password...
i entered my windows login name which is 'home' and entered 'kham00s' as the password... it didnt work... then i entered my windows login name again which is 'home' and entered 'OTHERPASSWORD' as the password which is my system password...but did not work either...
then i logged in using :
commandline> osql -E
It successfully logged in... and i was able to create databases and tables...
can someone tell me how to set a username and password for MSDE please... so that i can connect to MSDE using WebMatrix...
i m coming from a PHP/MySQL background so i know SQL and stuff... but dont know how to handle and configure MSSQL...
waiting for the response..
thanks in advance...
Bye.
Kamran.
View 6 Replies
View Related
Jan 11, 1999
I want to establish logging using NT Security. The problem is that user names in NT have underscore(_). When I establish NT Scurity in SQL security manager, SQL Server tries to add blank names as login id and they will not go through. Is it manadatory to remove underscore from username?
Because of structrual hierarchy, I have different groups in NT to be mapped to SQL Server groups and each group has different permission on SQL tables. In some cases we might have same users in more than one group. I read that it is not possible if you use NT integrated security. Is there any thing that can be worked around this and is this problem still exists in SQL 7.
Janne Hakulinen gave me a reply (Appreciate that) but when I did as he said, I got no success. So I am asking him to reply me at alim@goldline.net and let me send him an e-mail.
Thank you in advance
Ali Malekshahi
View 1 Replies
View Related
Aug 16, 2000
I need to get into a database and need the password and username for a Microsoft SQL Server v.6.5 database. Can you help or do you know someone else who can? This database is owned by us and this is a "legal" project.
Thank you.
Michael A. Wise
Manager, MIS/IT
EBARA International Corporation
Cryodynamics, Electric Motor, Standard Pumps Divisions
"World's Leader in Liquefied Gas Pumps and Turbines"
350 Salomon Circle
Sparks, Nevada, USA 89434
775-356-2796, xt. 215; FAX: 775-356-2884
mailto:mwise@ebaraintl.com
www.ebara.co.jp/indexe.html
www.ebaratech.com
www.pumpsebara.com
View 1 Replies
View Related
May 23, 2006
Hi I've created a login in my SQL Server 2005 like this:
CREATE LOGIN testuser
WITH PASSWORD = 'TestPWD';
USE DB1;
CREATE USER testuser FOR LOGIN testuser;
GO
now i want to connect from a c# app with the following connection STring
"Data Source=TURM21;Initial Catalog= Db1; Database= Db1 ; USER = testuser; PASSWORD = TestPWD; pooling=false; "
and i get the following Exception:
SqlConnection Handle : System.Data.SqlClient.SqlException: 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.)
CAn somebody help me? Whats wrong? Is it my connection string?
Greetz
View 2 Replies
View Related
Jun 8, 2006
I set up a group within an SQL Server database, of which I am a member. In some visual basic code, I do a dislay of user names.
My question: why does the code show my individual name (Servermyname) as opposed to showing the group name I want to see? I have confirmed that the only user of the database is the group, and not an individual user name.
Any ideas? Thanks!
*********************************************************************
This forum is best viewed with a computer. Questions asked freely. Confusion happily shared.
View 3 Replies
View Related
Sep 30, 2006
Hello
I newly installed the SQL Server 2005.During installation i chose the option Mixed Mode.I aslo did nit mention any user name and password to the SQL Server.Iam able successfully create Databases using the SQL Server Management Studio.
My problem iam unable to connec to the SQL Server from my .net windows application.My application code is
Dim strCon As String
Dim sValue As String
Dim strQuery As String
Dim dsEventTransac As New DataSet
Dim daEventTransac As New SqlClient.SqlDataAdapter
Dim rowCount As New Integer
Dim oWebService As New WebReference.TkmService
'Dim nwRow As DataRow
'Dim delCmd As SqlClient.SqlCommand
strQuery = "SELECT * FROM EventTransaction"
strCon = "Data Source=localhost;integrated security=SSPI;initial catalog=KmsDb;User ID=sa;password="
objCon = New SqlClient.SqlConnection(strCon)
If objCon.State = ConnectionState.Closed Then
objCon.Open()
End If
daEventTransac = New SqlClient.SqlDataAdapter(strQuery, objCon)
Dim cmdBuilder As New SqlClient.SqlCommandBuilder(daEventTransac)
daEventTransac.Fill(dsEventTransac)
'update the DataAdapter
daEventTransac.Update(dsEventTransac)
oWebService.Url = "http://192.168.0.10/TkmService1/TkmService.asmx"
''display the table in a grid
dgEventTransac.DataSource = dsEventTransac.Tables(0)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub DataGrid1_Navigate(ByVal sender As System.Object, ByVal ne As System.Windows.Forms.NavigateEventArgs) Handles dgEventTransac.Navigate
End Sub
End Class
When i donot specify user ID and password i get connected correctly.But when i run the above code i get an error
"Unable to connect to the remote server"
Now i want to change the username and password.Please tell me how to do
View 2 Replies
View Related
Jun 11, 2007
How do you set a username and password for a database in SQL Server 2005?
View 1 Replies
View Related
Oct 16, 2007
Hi,
I had deleted the login and user in my SQL 2005 database. However, each time when i connect to my database using the SQL enterprise manager, I can still see the deleted username under the login. It seems that the username is stored or cache somewhere after the first time that I have login. Does anyone know how to clear it? I am using SQL 2005 authenication method on 2003 Server machine. Thanks.
Regards,
View 14 Replies
View Related
Dec 28, 2005
Does this make sense for a logon table:CREATE TABLE Logon(ID INT NOT NULL IDENTITY PRIMARY KEY,name VARCHAR(15) NOT NULL,password VARCHAR(15) NOT NULL)GOCREATE UNIQUE INDEX IX_Logon_Name ON Logon(name)CREATE INDEX IX_Logon_NameAndPassword ON Logon(name,password)GOI do want the name to be unique but also will search frequently on bothname & password. Is this how it should be done? I don't fullyunderstand the difference between placing a single index in name &password VS one on both name & password.
View 12 Replies
View Related
Jun 25, 2007
I'm trying to get into an installation of v.6.5 to use with anotherserver and I need the following information:Database hostnameDatabase nameDatabase usernaneDatabase passwordIs this information available anyplace within the installation files?I'm not asked for uname and pwd to get into the database.Thanks!
View 1 Replies
View Related
May 18, 2007
I have two questions -
1. I have deployed the reports on our webserver. When I access the link http://servername/Reports from IE it asks me for a username and password the first time. I tried all the passwords including admin user/pwd but the dialog remains there. I close IE and start again I can access the reports. For your information, the checkbox 'Save my password' is checked in the reports. Does anyone know why the username/password dialog appears the first time?
2. Sometimes some of us get a 'Page cannot be displayed' while the others can access it. I have to start Reporting services and everyone can access the reports. Any ideas?
Thanks!!
View 3 Replies
View Related
Nov 9, 2005
How do I specify the SMTP username and password for reporting services? It seems like I can specify one for SQLmail, but not reporting services? How the heck is anyone going to use the email feature of reporting services without being able to specify smtp credentials or making their mail server an open relay for spam??
View 16 Replies
View Related
Apr 17, 2007
I am not so familiar with SQL Server 2005, but the problem is that when i created a vies and try to save it, instead of the name starting with the dbo. prefix, its starting with my username.
And i just found out that this is not happening only in the view its happening where ever i created an object and try to save it.
How can i change this from my username to make it display dbo. instead.
I think this is why i'm getting permission error when i try to use DTS package.
View 7 Replies
View Related
Oct 14, 2006
I am creating a membership site. I’d like to be able to have members be able to send customized e-mail to their own individual e-mail list. In creating the mail function (at least just a simplified version so I can get the basics to work), I’m using a select statement that uses @UserName as a parameter in the WHERE clause. I can’t get this work, however, and one of the error messages I get says “must declare the scalar variable '@UserName'". Below is the code I’ve come up with, which may be far off. I'm new to programming so please keep that in mind. I’m using Visual Studio 2005 and SQL Server 2005. If anyone has any suggestions, I’d really appreciate it! Thank you.Imports System.Net.MailImports System.Data.SqlClientImports System.Web.UI.WebControlsImports System.WebPartial Class emailInherits System.Web.UI.PageProtected Sub btnSend_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSend.ClickDim MyEmail = New MailMessageDim MyClient = New SmtpClient("localhost")Dim FromAddress = New MailAddress(Profile.Email)MyEmail.From = FromAddress'-- Create MailAddresses from a database'-- Open a database connectionDim DBConnection = New SqlConnection( _"Server=localhost; Integrated Security=True; database=WebSite18database")DBConnection.Open()Dim SQLString As StringDim SelectParameters = New Data.SqlClient.SqlParameter("@UserName", Data.SqlDbType.VarChar)SQLString = "SELECT [UserName], [ClientFirstName], [ClientLastName], [CleintEmail], [ClientID] FROM [Clients] WHERE ([UserName] = @UserName)"Dim DBCommand = New Data.SqlClient.SqlCommand(SQLString, DBConnection)'-- Retrieve a recordset of selected records from the databaseDim DBReader As SqlDataReader = DBCommand.ExecuteReader()While DBReader.Read()Dim ToAddress = New MailAddress(DBReader("ClientEmail"))MyEmail.To.Add(ToAddress)End WhileDBReader.Close()DBConnection.Close()MyClient.Send(MyEmail)End SubEnd Class
View 2 Replies
View Related
Dec 26, 2006
I have looked and tried with no luck on using the Profile.UserName in an SQLDataSource Update select statement. and anyone please help me with this?UpdateCommand="UPDATE tblDocuments SET DocumentTypeID = @DocumentTypeID, DocDescription = @DocDescription, DocLocation = @DocLocation, DocStartDate = @DocStartDate, DocEndDate = @DocEndDate, LastUpdate = GETDATE(), LastUpdateBy = @ProfileUser WHERE (DocumentID = @DocumentID)" <UpdateParameters>
<asp:Parameter Name="DocumentID" />
<asp:Parameter Name="DocumentTypeID" />
<asp:Parameter Name="DocDescription" />
<asp:Parameter Name="DocLocation" />
<asp:Parameter Name="DocStartDate" />
<asp:Parameter Name="DocEndDate" />
<asp:Parameter Name="ClientID" />
<asp:Parameter Name="ProfileUser" />
</UpdateParameters>
View 2 Replies
View Related
Dec 31, 2006
I have a simple insert statement that takes values from textboxes and inserts them into a sql server database. I would like to add a value that is selected from a dropdown list and find its corresponding unique "Id" value and insert into the database as well. My sql statement looks like this:string strSQL = "INSERT INTO aspnet_Expenses (ExpenseDate,RentalCar,ect..) VALUES (@ExpenseUserId,@ExpenseDate,@RentalCar,ect..)";I would like to add this to it: SELECT @ExpenseUserId = UserId FROM aspnet_users WHERE Username = ExpenseUserName1) How do I assign the value from the dropdown list to save as the "ExpenseUserName"and2) Am I on the right path with this at all?
View 3 Replies
View Related
Mar 22, 2007
Hello!
I can't figure it out how to create a database with an username and a password. I'm using Visual Studio 2005 and Microsoft SQL Server 2005.
Can someone help me out?
Greetings,Persyn Bert.
View 6 Replies
View Related