How To Set The Current ConnectionString User As A Defualt Value?

Feb 19, 2007

Hi,

I'm using username & password in my connectionString to connect my program (C#.net) with Sql Server 2005..

I put in defualt value in one feild: user_name()

it replace the user: dbo, not the user which I used in my connectionString.

so.. how to get this user??

 

I tried to put: currnet_user

but I get the same result, "dbo" not the user in my connectionString..

 

View 4 Replies


ADVERTISEMENT

Cannot Open User Defualt Database. Login Failed.

Dec 15, 2006

Hi,
I know that there have been numerous posts on this topic, however none of the suggestions seems to resolve my problem. I am running a ASP 2.0 web application locally using SQL server 2005 express, but after using SQL Server Management Studio to browse the database of the application i get the following error everytime i log into the website:
Cannot open user default database. Login failed. Login failed for user '<<machine name>>ASPNET'
All i had done is attach then detatch the database in SSMS and it seems to have changed the access permissions somehow.I have ensured that the ASPNET user has full permissions (server roles and User mapping) in SSMS and i have granted the ASPNET user full rights to the ASPNETDB.MDF and log file, but i still get the same error.
Its really urgent i sort this problem out as soon as possible, so if anyone has tackled this problem before please help. Ideally i don't want to have to reinstall sql server, but if that is the only option and it will definitely fix the problem then i will.
Thanks,
Jack

View 3 Replies View Related

Current User

Jul 20, 2005

Am using SQL Server 2000, and am writing some audit triggers. How do I getthe the name of the user, eg. user_id or current_user. Just spent an hourlooking through the SAMS book for this, and can't find any reference.

View 5 Replies View Related

How To Get Current Loggedin User?

Oct 19, 2007



Hi,
I am using SQL server 2005 (express). I have a user like "test" with some password.
After login with this userid and password i tried to get the current user executing

Print CURRENT_USER but its displaying the result as 'dbo' instead of 'test'. In server roles for this particular login i have marked all the options.


Can anyone tell me why i am getting like this? What permission/setting i am missing?

Thanks
Shobha

View 6 Replies View Related

Finding Current User

Jan 21, 2008

Hi,

I have created a DataSet that queries a table containing users names.




Code Block
SELECT * FROM myTbl
WHERE UserName = @Username



How do I automatically set @Username to the current user?

Thanks.

View 3 Replies View Related

SqlDataSource Control And Current User

Jan 5, 2006

After some help from the folks in the Security forum, I have some of the answer I need. Hopefully someone here can help me figure out the best method of using that information to find a final solution.
To start, here's a brief synapsis: I'm developing an App in ASP.NET 2.0, using forms-based authentication and the Login Control. I am able to login fine as far as I can tell, since I am able to proceed to the destinationURL without error. From there, I button click to the application in question. Here is where I have the problem.
I want to run a select query on a SQL table where a field = the current user's Username. I cannot find any examples of doing this. I have managed to figure out how to retrieve the current user's username via the Membership.GetUser method, but I can't seem to figure out how to apply that to my SqlDataSource Control and get a valid response.
a snippet of my control's code follows:
<script runat="server"> - This is run inline, not code-behindProtected memUser As MembershipUser

Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)memUser = Membership.GetUser()End Sub</script>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SWGToolsetConnectionString %>"SelectCommand="SELECT [CharacterName] FROM [Characters] WHERE ([UserID] = '<% =Server.HtmlEncode(memUser.Username) %>')"></asp:SqlDataSource>
If anyone can tell me what I can or should be doing differently, I would appreciate it.

View 4 Replies View Related

The Current User Is Not An Owner Of The Selected D

May 29, 2007

I have a SQL 2005 question for you. In the SQL server Management Studio. When I right click on the database and use the SQL Server Import and Export wizard, I can import databases but cannot export them.

The error says:

The current user is not an owner of the selected database. This might cause some operations with this database to fail.


I use sa to loginto the server Management Studio, does anyone know how to create a database where the user and owner are the smae so I can export?

View 1 Replies View Related

Dataset Filter By The Current User

Dec 7, 2007

Is there a way to only return the data that the user is allow to see?

Example:
A student login into the Report Server and open the Class Report It will only display all the classes this student is in.

View 1 Replies View Related

How Many User Current Connect To A Row In Table.

Nov 9, 2006

Hi all...
Iam a newbie and i have one question want to ask experts ... .
I am current working on one App which have some user connect to database at the same time.
And i want to know: how many user connect or use (read , update) to one row in a table?
Could it be possible to know that??? If you have one solution to solve this problem , please let me know :) ...
Could it be done by Software , T-SQL or anything ...., iam happy to know.
Thanks all.

View 8 Replies View Related

What Is The Defualt Database?

Jan 13, 2006

hi,
i am trying to install asp.net portal starter kit but i am getting error
that the program can not open the default database server.

what is the default database?

TIA

View 1 Replies View Related

Select Records For The Current Logged On User

May 14, 2007

Hi all
I've been having a really difficult time finding out how to run a query which selects records from an SQL database for the current logged on user. I've tried a whole manner of different approaches but here is where I am at now:
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If Not Page.IsPostBack Then
ds_meobservingcolleagues.SelectParameters(0).DefaultValue = User.Identity.Name
End If
End Sub
</script>
 
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="ds_meobservingcolleagues">
</asp:GridView>
<asp:SqlDataSource ID="ds_meobservingcolleagues" runat="server" ConnectionString="<%$ ConnectionStrings:StPaulsDatabase %>"
SelectCommand="SELECT [observeTeacher], [observeBy], [observeReason] FROM [Observations] WHERE ([observeBy] = @observeBy)">
<SelectParameters>
<asp:Parameter Name="observeBy" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
 
This is not resulting in any error. But it is not returning the records that it should be either.
Please can anyone help? I'm sure it shouldn't be this difficult to do

View 3 Replies View Related

The Current User Is Not An Owner Of The Selected Database

May 29, 2007

I have recently installed SQL 2005 I use the SQL ecpress and management studio.   In the SQL server Management Studio, when I right click on the database and use the SQL Server Import and Export wizard, I can import databases from the web hosting I'm workign with to my mycomputer, but cannot export them.
 When I try to export database tables with the SQL Server Import and Export wizard
The error says: The current user is not an owner of the selected database. This might cause some operations with this database to fail.I use sa to log into the management studio aand creat teh database after I login.  How do I create a database so that the user and owner match and will allow me to export tables and data?

View 5 Replies View Related

Connection String Based On Current User

Oct 23, 2007

Hi All,
His there any way to build a connection string to sql server based on the current user credential?
I mean, intead of using
user id=Adminpassword=adminPass
Is it possible to do something like
user id= Context.User.IDpass=???
I'm asking cause, iI don't want to use impersonisation in my code.So that I can be sure logged user only sees what they can
(I'm a newbie, so this whole thing may makes no point(thanks for clarifying

View 4 Replies View Related

How Can I Get Current Year In The User Defined Function.

Nov 17, 2005

I have a user defined function in datebase SQL 2000. function looks like
create function Getcurrentdate(@month int, @day int) returns smalldatetimebegin
declare date1 as smalldatetime--get current year --convert month, day and year into current date. then return
return date1end
my problem was , after using getDate(). I get error meassage which is "can'not use getDate() inside user function"How can I get current year in the user defined function. Thanks

View 3 Replies View Related

User Or Role Already Exists In The Current Database

Oct 9, 2000

Hi!
I've restored a backup from server A in server B. In server A I used to have a db_owner, called sitebase. After restoring the backup in server B, I created the user sitebase again and tried to grant him db_owner through Server Manager but I got the error: user or role already exists in the current database.
How can I avoid this situation and grant db_owner to him?
Thanks,
Fábio

View 1 Replies View Related

Find Out If Current User Is Member Of A Role

Aug 5, 2004

I need a stored procedure to find out if the current user is a member of a certain role. I want to pass the role name and return a bit to tell whether he is a member or not. I have this code to list the groups the current user is a member of but I don't know how to search or do a "SELECT FROM" on the results.DECLARE @usr varchar(32) SET @usr = USER EXEC sp_helpuser @usr But if the current user is a member of more than one role it returns multiple rows. So if I could do something like: DECLARE @grpName varchar(32) SELECT * FROM (EXEC sp_helpuser @usr) WHERE GroupName=@grpNameIF rowcount > 0 THENRETURN 1ELSERETURN 0END IF I know that doesn't work so how can I do this?

View 6 Replies View Related

Display Current Password For User Account

Aug 20, 2007

Hi everyone -

Is there a way to display the current password for a user account
on SQL server 2000???

thanks
tony

View 14 Replies View Related

How To Find All Permissions In The Current Database For A Particular User

Oct 4, 2006

How to find All Permissions in the Current Database for a particularUser in SQL 2005 ?ThanksM A Srinivas

View 1 Replies View Related

The Current User Is Not An Owner Of The Selected Database

May 29, 2007

I have a SQL 2005 question for you. In the SQL server Management Studio. When I right click on the database and use the SQL Server Import and Export wizard, I can import databases but cannot export them.



The error says:

The current user is not an owner of the selected database. This might cause some operations with this database to fail.


I use sa to loginto the server Management Studio, does anyone know how to create a database where the user and owner are the smae so I can export?

View 5 Replies View Related

Please Help! How Can I Check The Current User Against A Specific Database?

Apr 29, 2008

In my application (infopath browser forms), First I get current user name thru System.Environment.UserName, after that, i want to check whether this user has access (read & write) permission to certain database, How do I do that?
One way I tried before is to get all the users and stored the names in an array for comparing in my program, but can not figure out the SQL command (to get the database users), if there it is, please kindly tell me.
Or if I can just pass the current user to check?
Thanks in advance.

View 5 Replies View Related

HttpContext.Current.User.Identity.Name Blank ?

Mar 2, 2007

I have implemented the forms authentication method using  MSDN web site http://msdn2.microsoft.com/en-us/library/ms160724.aspx

and now i want to modify that code

so when i used

Dim UserName as string =HttpContext.Current.User.Identity.Name

from the vb.net code behind

it gives me ss as blank value ?

but the same code i used from the normal web site its gives me the

"SER1Administrator" value for that string(current user)

so my problem is why is that code not working for the report server sample project ,which microsoft provided ?

do i have to change any configuration settings ?

please help me .......i am in trouble ?

(what i really want is i need to get the username from the active page directory? wheather this username exist from the active page directory.)

 

regards

sujithf

 

 

View 1 Replies View Related

How To Current Logged Windows User Name In Tsql

Mar 27, 2006

Hello



how can i get current logged windows user name in tsql. I know with windows aut it is possible how can i get this when sql auth.

Is there any system function or any special codeing required ?



regards

Chikuu

View 8 Replies View Related

Date Created Defualt Value

Jul 1, 2007

 in my database i have a "datecreated" feild, its datatype is "datetime", is it possible to set the defualt value as the time now? if so what do I put in the defualt value property? thanks a million si!

View 2 Replies View Related

SQL Express Datatime Defualt

Apr 28, 2008

Hi everybody

I pages and use Ms sql Express and would like to have it condition-shape defual value to be the date, but if I choose the field have to be date-hour and then defual value chooses have nowly () to be it doesn't give myself any law, some that know what I do mistakes here?

View 2 Replies View Related

HttpContext.Current.User.Identity.Name Form SQLDataSource

Apr 21, 2007

Hi,How do I get hold of the HttpContext.Current.User.Identity.Name from within an sqldatasource? I want to create a WHERE clause that says WHERE UserName = @UserName and the @UserName parameter be filled with the current user name. I would be able to do this in code, but I don't know how to get at this information from within a datasource. At a guess I tried to use the Cookie option from the drop down list, and use the name of the FormsAuthentication Cookie, but this didn't work. Is there a way I can do this? If so how? I don't want to resort to using a hidden field or anything like that if I can help it. Many thanks, Steve 

View 2 Replies View Related

Set Default Schema To Current User For Call Database

Apr 20, 2013

i have database and set default table schema to "ray" and me must input ruy.TABLE-NAME for retrive data !!! , i need set Default Schema to current user for call database as just database name(for my program) , how changed it ? (i change default schema for current user by alter command but not worked !)

View 1 Replies View Related

Transact SQL :: How To Check If Current User Has Sysadmin Privs

May 27, 2015

Is there a simple command that can be executed to check if the current user has sysadmin privs?  I just want to check to see if I have sysadmin privs and if so then execute a command, if not do nothing in .Net code.  I just want to do this check once and set a variable in the .net code.

View 4 Replies View Related

Setting The Defualt Database In SQL 2005

Mar 28, 2006

Its not a big deal but enoying enought that i always have to

USE MyDatabase

-- Instead of having it set as the defualt and not adventureworks

View 3 Replies View Related

Visibility Of Defualt Valus In Front End .adp

Feb 14, 2008



Don't know if this is the right place to ask the question, didn't know where to put it...

Strange thing is happening to me...I created different forms that all point (Record Source) on tables (one form - one table). Each table has some columns with Default or Binding Value set.
I have a user that has Insert, Delete, Update and Select permissions.

When I insert a new record using the front end, some forms show the default values correctly, others don't show them at all (all the columns that should be populated with a default value are empty). If I add a View Definition permission to problematic tables --> surprise, surprise, default values get implemented...I'm confused...

Any ideas? Can a user w/ View Definition do some damage to the table?

View 8 Replies View Related

How To Fix &#34;Error 15023: User Or Role &#39;%&#34; Already Exists In The Current Database

Sep 20, 2001

I used a backup copy of our production DB (residing in our prod machine) to do a database RESTORE to our test DB (residing in our test machine). This step was successful.
However when I tried to access the test DB via Peoplesoft application, I am unable to logon. Only then did I notice that all the users, with the exception of "sa", were gone.
When I attempted to add a user via Enterprise Manager's Action - Add Database User, I get the message, "Error 15023: User or role '%' already exists in the current database.
What's the best way to fix this without resorting to copying the source server's master database (If i do this, I risk clobbering some other DB's that are present in the target server but not in source server)?
Any help you can provide will be greatly appreciated!!!

View 2 Replies View Related

Audit Transformation Uses CURRENT Lengths For User Name And Machine Name Columns

Dec 2, 2007

I'll try to reproduce this later, but want to report it before I forget.

I just had my package fail on a VM I was testing on. It failed because on that machine, I logged in as MachineNameAdministrator instead of using my domain account (the VM is not in the domain).

This was a problem because the "User Name" column generated by the Audit Transformation was 17 characters long! This is the length of my domain + user name on my development machine. Similarly, the machine name length was 15 characters.

I'd love to know what the "correct" sizes are for these columns. In the meantime, I'm going to set these to 255 manually, and hope the size sticks.




P.S. There was one other post on this topic, though the thread isn't clear that this was the problem: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=472445&SiteID=1.

View 1 Replies View Related

User Is Not Able To Access The Database Model Under The Current Security Context

Feb 7, 2008

I have a restriced user on SQL Server that is only permitted to creat a new database and manage it only. All other database are hidden to that user.

when that user login to SQL Server and create a database and try to change the default folder path for data and log files, gets an error,

The Server principal "User" is not able to access the database "model" under the current security context. (MSSQL Server, Error: 916)

Any idea???

Thanks,

View 7 Replies View Related

A Floating Point Exception Occurred In The User Process. Current Transaction Is Canceled.

Jul 23, 2005

Hi,I'm running SQL Server Version 8.00.194 on Windows 2000.I am am running this query:select TOP 2000TheoVolImpliedfrom OptionTradeswhere ReutersSymbol = 'IBM.N'and TheoVolImplied > 0.0TheoVolImplied is of type float, precision 15, length 8.When I run this query I get this error:Server: Msg 3628, Level 16, State 1, Line 1A floating point exception occurred in the user process. Currenttransaction is canceled.If I run this query:select TOP 2000TheoVolImpliedfrom OptionTradeswhere TheoVolImplied > 0.0It works fine with no problems.If I run this query:select TOP 2000TheoVolImpliedfrom OptionTradeswhere ReutersSymbol = 'IBM.N'It works fine with no problems.Anyone have any ideas about what might be wrong?

View 2 Replies View Related







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