Relationship To UserId
Hi there everyone, this is my first post so go easy on me :)
Basically I am trying to get my database to copy the value in the UserId (unique identifier field) from the aspnet_Users table to a foreign key UserId in a table called userclassset. I have made this field the same datatype and created a relationship between the two. Unfortunately, when I add a user using the ASP.Net configuration tool it does not automatically copy this value into my own custom table. I have noticed it is however automatically copied into the aspnet_Membership table. Any pointers on how to solve this would be great!
Thanks :)
View Complete Forum Thread with Replies
Related Forum Messages:
Using Membership UserId Guids With SqlParameters (Membership UserId Guid)
In my site, when a user registers, I need to create rows in additional tables besides aspnet_Users. So, I need to be able to pass the generated userId guid to subsequent SqlCommands. I'm having a terrible time with this. What's the correct way to set up a SqlParameter so that it will accept a guid? I keep getting this error: "Conversion failed when converting from a character string to uniqueidentifier." I've tried creating the parameter both with and without a SqlDbType. cmd.Parameters.AddWithValue(paramName, guid); and SqlParameter p = new SqlParameter(paramName);p.SqlDbType = SqlDbType.Guid;cmd.Parameters.Add(p); and I get the same error either way. Driving me nuts! Any help appreciated.
View Replies !
How Can I Create A One-to-one Relationship In A SQL Server Management Studio Express Relationship Diagram?
How can I create a one-to-one relationship in a SQL Server Management Studio Express Relationship diagram? For example: I have 2 tables, tbl1 and tbl2. tbl1 has the following columns: id {uniqueidentifier} as PK name {nvarchar(50)} tbl2 has the following columns: id {uniqueidentifier} as PK name {nvarchar(50)} tbl1_id {uniqueidentifier} as FK linked to tbl1.id If I drag and drop the tbl1.id column to tbl2 I end up with a one-to-many relationship. How do I create a one-to-one relationship instead? mradlmaier
View Replies !
Sqldatasource Where UserId=
I am trying to configure a sqldatasource control using the where clause to grab a single record with a certain UserId. Teh UserId is stored in a variable of type System.Gui and I cant seem to figure out how to do this. Can someone give me a hand please?
View Replies !
How To Generate Userid?
Hello everyone. i need to auto generate the user id in id colunm in my sqldatabase table.i want it to generate in this fashion.(mycompanyname-todaydate-number.)eg (ibm-15thfeb-1) (ibm-15thfeb-2) (ibm-16thfeb-1)here i need this user id to be automatically displayed in my web form when doing registration of new user,then only after clicking the savebutton i want all the data along with user id to be inserted into the table in sqldatabase.thanksjack.
View Replies !
Sorting By UserID
I'm trying to sort by domain user id, I can pull the user id fine but now I want to sort my SELECT by that name. How do I put the value of getUserIdentity into my SELECT statment. Thanks <script language="C#" runat="server"> protected string getUserIdentity() { return HttpContext.Current.User.Identity.Name.ToString().Replace("DOMAIN\", ""); } protected void Page_Load(Object sender, EventArgs e) { username = getUserIdentity(); SqlConnection myConnection = new SqlConnection("Data Source=CLIENTELE;Initial Catalog=forms;Integrated Security=True"); SqlDataAdapter myCommand = new SqlDataAdapter("SELECT * FROM formTable WHERE userID = @username ORDER BY status DESC", myConnection); DataSet ds = new DataSet(); myCommand.Fill(ds, "names"); MyDataGrid.DataSource=ds.Tables["names"].DefaultView; MyDataGrid.DataBind(); } </script>
View Replies !
Asking For Userid And Passwords On 28
I have installed Sql Server 2000 Reporting Services. I desinged report in VS 2003.When press F5 key.Every time it is asking for user id password then only it is giving List of Report Names. Is there any way to avoid giving user id and pwd every time. Regards.
View Replies !
Userid And Machine Id
I wrote trigger to insert old data before update or delete . Now while inserting i want to insert userid and machine id for user id ia tried the following query as SELECT CURRENT_USER; it retuns o/p as dbo Please give me solution Malathi Rao
View Replies !
How To Make A Custom UserID?
Well, I want to store my customer records in two tables in an SQL Server 2005 Database. (Visual Studio 2005 with ASP.Net and C#). I want to create a unique ID for each user which starts with either an IN or a CO (indivudual or Company). This information is stored in two seperate tables, one table called individual and one table called company. I want my individual table to store a unique ID with IN************, so it should have IN followed by a 12 digit unique ID. I want my company table to store a unique ID with CO************, so it should have CO followed by a 12 digit unique ID. I'm afraid Unique IDs are something im not very familiar with, so any help would be greatfully appreciated, but please be clear as I have a bit of trouble understanding. I wouldn't know how to even begin this, as I have trouble using simply the UniqueIdentifier attribute. Thank you in advance for any help!
View Replies !
New Database, Set Userid And Password
I am creating a new application and just created a new database Application: VB.net 2005/ ASP.net Database: Sql Server 2005 with four tables I need to set the userid and password on the database. How do I do that? I want to be able to create a SQL connection object in my code and I have something like the following: <CODE> Dim objcon As New SqlConnection("server=serverName;uid=;pwd=;database=SomeDatabase") </CODE> but the "uid" and the "pwd" are not set on my database. what is an easy way to do this? thanks
View Replies !
UserID -&> Unique Identifier
Hello!I work with oracle, mySQL but im completely new to SQLserver.How can i set a auto-increment unique variable for userID ?After deleted user, the userID should be never used again on a new user.Thank you,
View Replies !
Can You Mirror A User To Another Userid?
I have a user which has the currect rights to do what he needs but others with the same permissions (from what I can tell) can not do somethings. It looks like I have 2 options a.) find a way to mirror the working one to 30 others ids or b.) find some tool that will do a detailed comparision of the two ids Any suggestions/tools(free)/scripts that would work? Thanks
View Replies !
Why It Requires Userid And Password.
When I tried to browse the reportserver url. The IE 7.0 asks me for Username and password. I feel, its some settings related to security. But other sites created are working fine. The virtual directories created using Repoting services configuration manager only ask me username and password. Any suggestions. Murali.
View Replies !
Not Able To Pass UserID Parameters
I have recently had a few reports that are built around the userid parameter start failing to pass the userid parameter. If I run the report and hard code the userid everything runs just fine, but I am not able to collect the userid when the user is logging into the report server. Any thoughts or suggestions? R/ AA
View Replies !
AD User's Full Name From UserID?
Hallo i would like to retrieve the user's full name in a SSRS2000 report: i mean, not the login name (the User.UserID), but the full name. In order to do this i think i should query AD by the login name, but maybe there's already a simpler way. Could you point me to any resource (an assembly, or a t-sql sp, anything like that) to achieve this? thanks!
View Replies !
DTSRun With Userid And Password
I use DTSRun /Uuserid /Ppassword /Sservername .... in a batch process. I always get the error message to run with a trusted connection. I can run the same batch process from a command line under my own domain id and it runs as if it had a trusted connection. Will DTSRun run only with a trusted connection? Do I need to set something in the package to get SQL Server to run with a userid and password? Why does it always default to using a trusted connection. I need to know what I have to set to tell it that I am using a userid and password. I have included an example of how it's coded in the BAT file. Example: DTSRun /S"myserver" /Umyuser /Pmypass /N"Load_Data" /L "c:mylogsLoad_Data.log" /W"0"
View Replies !
Application Userid As Dbowner
our application user is a db owner and my auditor has asked me to change the permission. what permission should be give for the application user who can access all the schema. create temprorary table and drop tables.
View Replies !
Get Latest Entry Per Userid
Hi, I have the following situation: I have a table that is log of transactions of useractions. Each time a userstatus changes, a new entry is made into the table. The table has (currently) about 4 million records, and keeps growing each day with thousands of records. It logs the status of about 150 users (currently active). What I now want is to get the log-entry from all the distinct users that have a log-entry on the latest day (so current day, 'where TimeStamp > 2008-04-08'). (extremely simplified) Example: (date is y/m/d) USERID TIMESTAMP STATUS ---------------------------------------------------- ... (thousands and millions of records above) Ed 2008-04-07 18:00:00 Logged_Out Jim 2008-04-07 18:30:00 Blabla_Status_5 Jack 2008-04-07 19:00:00 Logged_Out Jim 2008-04-07 19:30:00 Logged_Out Jim 2008-04-08 06:00:00 Logged_In (<< notice new day) Jim 2008-04-08 06:01:00 Blabla-Status_1 Bob 2008-04-08 06:03:00 Logged_In Fred 2008-04-08 06:05:00 Logged_In Jim 2008-04-08 06:08:00 Blabla-Status_2 Jack 2008-04-08 06:12:00 Logged_In Fred 2008-04-08 06:20:00 Blabla_Status_5 Jack 2008-04-08 06:12:00 Logged_Out Fred 2008-04-08 06:12:00 Blabla_Status_4 Jack 2008-04-08 06:12:00 Logged_In Jack 2008-04-08 06:12:00 Blabla_Status_7 ---------------------------------------------------- The result should be: USERID TIMESTAMP STATUS ---------------------------------------------------- Jack 2008-04-08 06:12:00 Blabla_Status_7 Fred 2008-04-08 06:12:00 Blabla_Status_4 Jim 2008-04-08 06:08:00 Blabla-Status_2 Bob 2008-04-08 06:03:00 Logged_In ---------------------------------------------------- (How) can this be done in one stored procedure?
View Replies !
How To Retrieve Userid And Pwd Of Sql Server
I am writing a VBscript which takes my machine details and put in the SQL database. But after executing the script , i got the following error: Microsoft OLE DB Provider for SQL Server: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. I dont remember the password I have given during installation. Please tell me how to get the password of sql server.
View Replies !
How To Customize Auto Generated Userid?
Hello everyone,i have a web form to take user details.as soon as the submit button is clicked the form is submitting and the new row is being added into the sqldatabase.its fine ..but in the newly added row, i want the user id(primary key and auto generating) to display in different manner.in mytable column(userid),instead of userid auto displaying 1,2,3,4 ...i want it to display in this way.these are all primary keys of rows added.todaydate-username-1 eg(2.2.2008-jack-1)todaydate-usernaem-2 eg(2.2.2008-zak-2)todaydate-usernaem-3 eg(2.3.2008-leme-2)any idea how to achieve this.?thanks.jack.
View Replies !
Joining Tables On Aspnet_Users.UserId
I want to join my existing tables such as ORDERS with aspnet_Users.UserId on ORDERS.CustomerId.But I am confused which data type should I choose for customerId field.The datatype of the of aspnet_Users.UserId is uniqueidentifier, but obviously I cannot assign my customerId field to uniqueidentifier data type. I found that "The uniqueidentifier data type in SQL Server is stored natively as a 16-byte binary value." I wish aspnet_Users.UserId would be an integer IDENTITY field. I also want to ask if I can change UserId field's datatype to integer?There are also some other tables that I want to join with aspnet_Users table on its UserId field. Can you suggest any solutions?
View Replies !
Reading Userid/password From Database
can somebody help me acheive this? I need to output pdf files to a shared folder on the webserver. since i have to schedule a lot of reports, i dont want to be typing in userid and password while scheduling every report. I want to be able to choose a database field for userid and another for password. is this possible, i assume so because of the fact that these fields have an option of selecting from query. when i do this, i get an error about encription. thanx.
View Replies !
Loggin Userid From Trigger Using APP_NAME
Hi I have to implement table level loggin on a bunch of tables. The problem is that I also have to log the user that made the changes Obviously the right way would be to run everything tru stored procs - but that is not possible for me because there is a lot of existing functionality built already - some direct sql and a super large number of sprocs. So I wanted to go with a trigger based approach .However since the changes are being made by a web app SQL has no idea who the actual web application based user is. I originally tried to solve the problem by adding a LastUpdatedBy column to some of the tables and forcing the functions to update that too - so that the trigger can read that column but that has turned out to be very tedius and buggy. So I want to try something else - so far it seems to be working but I just want to make sure I am not messing up anything along the way. There is a function is TSQL called APP_NAME() , this return the name of the application that started the connection that the TSQL is running in. This made scense during the desktop days when it would return the actual .EXE name of the file that executed the changes. Nowadys it's not so usefull any more becuase in a web based app all changes are being done by aspnet_wp.exe so i don't know if that info is usefull - as a matter of fact all access thru ado.net default to ".Net SqlClient Data Provider" . So my thinking is like this - if I add 'Application Name= userid" to the connection string before I open it - then I will have access to that userid thruout any changes that usermakes via APP_NAME() I realize that I may be messing up the connection pool a bit - but I have relativley few (60) users who are on the system for long spans - so each one will be able to reuse their own connectiions. I just want to make sure before I go off on this that i am not messing things up badly Thanks for reading this whole thing
View Replies !
Asking Userid And Password While Deploying Reports
Hi All, While deploying reports on the reports server, it is asking to supply user name and password. When I entered the same, it didn't accept them. What do I need to do? Is there any specific setting which I need to configure? An immediate reply will be highly appreciated. Thanks Sekhar
View Replies !
UserID With Custom Security Extension
Hi, I am working on a website with reports built in SSRS 2005. Because internet users will be the consumers of these reports, I have implemented a custom security extension for SSRS that's very similar to the sample security extension. I have 3 issues: 1. Currently my reports reference the current user using a hidden report parameter called SubscriberID which is sent to the report. Obviously this is a security issue and with the custom security extension I will be using the User!UserID instead. My question is, would it be secure enough to change that parameter to internal and make its value User!UserID? What I'm getting at is, am I correct in assuming the end user cannot change internal report parameters (via URL or any other way)? 2. To uniquely identify a user I actually need 2 integers, because of some requirements of the website. So I would need to somehow encode both these numbers in the UserID. I realize there are many illegal characters for User names in SSRS, but it seems to me from the sample extension that I could have the userID format be the following (without the angle brackets): <Int1>.<Int2> I could then in my reports parse the User!UserID to get Int1 and Int2. What I'm wondering is, am I overseeing some simpler solution to this situation? It also seems to me that there is no separation between a user name and UserID in SSRS. Is there a way to separate the two? Should I even bother doing so? 3. Related to #2, if I use the format of <Int1>.<Int2> for UserID, it seems strange to me that I would have to add users with such names to the SSRS privileges when people subscriber on the website. It seems to me another solution would be to change how my custom security extension works and instead of it looking at the standard permissions in SSRS (e.g. built in role permissions) to determine if a user is allowed to do a certain SSRS action, it could directly determine from the UserID if they are allowed to perform certain SSRS actions. Does that sound like a reasonable solution? Thanks for any help, Liron
View Replies !
How To Create Database Having Userid And Password
Hi, I am using the sql server for creating the database. I want to create the database which is having userid and password. This I require since I wanted to restrict acces to database and also only authorise user to database can use the userid and password created at time of creation of database. So how can I create the database which is having userid and password?
View Replies !
I Want Storedprocedure For This Requirment Am Passing One UserId Parameter
My Required tables are I am Passing one parameter Is UserID Table Name : SC_Attendence ColumnName Datatype AttendanceID int CompanyID int AttendanceDate datetime SectionID int Table Name : SC_AttendenceDetails Columnname Datatype AttendanceDetailID int AttendanceID int UserID int IsAttended bit IsLate bit Table : SC_UserSections columnname Datatype UsersSectionId int UserId int SectionId int CreatedDate datetime Month NoofAttendenceDays NoofPresentdays January 25 21 Febrauary 22 19 March 25 22 Thanx in advance It's very urgent
View Replies !
Stored Procedure To Retrieve UserId From Aspnet_Users
Im a bit confused on my programming skills. I know how to add a user and password using the Membership.CreateUser class. ' Define database connection Dim conn As New SqlConnection("Server=localhostSqlExpress;" & _ "Database=lnp;Integrated Security=True") ' Create command Dim comm As New SqlCommand( _ "SELECT oldLogId, oldPassword FROM userDetails WHERE (oldLogId = N'chuck') OR (oldLogId = N'top_dawg')", conn) ' Open connection conn.Open() ' Execute the command Dim reader As SqlDataReader = comm.ExecuteReader() ' Do something with the data While reader.Read() Dim partPassword = reader.Item("oldPassword") ' Adds underscore character and first 3 letters of password for distinct USER ID Dim newUserID = reader.Item("oldLogId") & "_" & partPassword.SubString(0, 3) ' Create User if Valid Try Membership.CreateUser(newUserID, partPassword) Catch ex As MembershipCreateUserException ' Code that is executed when an exception is generated ' The exception's details are accessible through the ex object usersLabel.Text &= "<p><strong>Exception: " & newUserID & "</strong><br />" & ex.ToString() & "<br /><strong>Message: </strong><br />" & ex.Message & "</p>" End Try End While usersLabel.Text &= "<p><strong>END OF RECORDS</strong></p>" ' Close the reader and the connection reader.Close() conn.Close() But now I want to do something in a Stored Procedure USE [lnp]GOSET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE PROCEDURE [dbo].[sp_createPortingDetailsWithUsers]-- Add the parameters for the stored procedure here @passUserId NVarChar(50), @passPassword NVarChar(50)ASBEGIN-- SET NOCOUNT ON added to prevent extra result sets from-- interfering with SELECT statements.SET NOCOUNT ON;Membership.CreateUser(@passUserId, @passPassword)Select SCOPE_IDENTITY()ENDBut when I try to execute this in SQL SERVER MANAGEMENT STUDIO EXPRESS, I get an error near the line MEMBERSHIP.CREATEUSER(@passUserId,@passPassword)Msg 102, Level 15, State 1, Procedure sp_createPortingDetailsWithUsers, Line 11Incorrect syntax near 'Membership'. What I want to do is create a user with a UserID and Password that I am passing from a table and then retrieve the USERID (unique identifier) when I create the new user. Can anyone suggest or show a tutorial on what I am doing wrong? I appreciate any assistance in advance,Chuck
View Replies !
Can't Take Database Back On Line With Db_owner Userid
Hi, I have granted db_owner to a user id. This userid was able to take a database offline, but when trying to bring the database up online, I got an error message 5011, user doens't have permission. Does anyone has any idea why? I read in books on line saying that db_owner fixed roles has permssion to set this database property. Thanks.
View Replies !
Get Application UserID From Context Connection To CLR Trigger
Hi Everyone- i have a web Application and i access the database through ado.net connection and have built a CLR Trigger on each table the problem that i want to pass a variable (e.g Application UserID) from the application to the CLR Trigger as i know there is no direct way for doing this ,isnt there work around for this , set variable to something and then the trigger read it . I hope someone help Thanx Maylo
View Replies !
Custom Paging - Getting A Subset From 2 Tables By UserID
I am trying to implement custom paging. I want to get a subset from my Threads and Post tables by userID. But I can't make the stored proc work. Could somebody have a look at this and tell me what I am doing wrong or if there is a better way of doing this? ALTER PROCEDURE [dbo].[syl_ThreadPost_GetSubsetSortedByUserID2] @UserID uniqueidentifier, @sortExpression nvarchar(64), @startRowIndex int, @maximumRows int AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON BEGIN TRY IF LEN(@sortExpression) = 0 SET @sortExpression = 'PostID' -- Since @startRowIndex is zero-based in the data Web control, but one-based w/ROW_NUMBER(), increment SET @startRowIndex = @startRowIndex + 1 -- Issue query DECLARE @sql nvarchar(4000) SET @sql = 'SELECT t.[ThreadName], p.PostID, p.[PostTypeID], p.[LanguageID], p.[PostAccessID], p.[UserID], p.[ThreadID], p.[PostParentID], p.[VoteSummaryID], p.[Subject], p.[Body], p.[PostAuthor], p.[PostDate], p.[IsApproved], p.[TotalViews], p.[FormattedBody], p.[IPAddress], p.[PostCount], p.[ArticleCount], p.[TrackbackCount], p.[IsSticky], p.[StickyDate] FROM (SELECT t.[ThreadName], p.PostID, p.[PostTypeID], p.[LanguageID], p.[PostAccessID], p.[UserID], p.[ThreadID], p.[PostParentID], p.[VoteSummaryID], p.[Subject], p.[Body], p.[PostAuthor], p.[PostDate], p.[IsApproved], p.[TotalViews], p.[FormattedBody], p.[IPAddress], p.[PostCount], p.[ArticleCount], p.[TrackbackCount], p.[IsSticky], p.[StickyDate], ROW_NUMBER() OVER(ORDER BY ' + @sortExpression + ') AS RowNum FROM syl_Threads t RIGHT OUTER JOIN syl_Posts p ON t.[ThreadID] = p.[ThreadID]) WHERE t.[UserID] = ' + CONVERT(nvarchar(16), @UserID) + ' ) AS syl_ThreadPostInfo WHERE RowNum BETWEEN ' + CONVERT(nvarchar(16), @startRowIndex) + ' AND (' + CONVERT(nvarchar(16), @startRowIndex) + ' + ' + CONVERT(nvarchar(16), @maximumRows) + ') - 1' -- Execute the SQL query EXEC sp_executesql @sql RETURN END TRY BEGIN CATCH --Execute LogError_Insert SP EXECUTE [dbo].[syl_LogError_Insert]; --Being in a Catch Block indicates failure. --Force RETURN to -1 for consistency (other return values are generated, such as -6). RETURN -1 END CATCH END
View Replies !
RS Integration With SharePoint 3.0 - Query With Userid Parameter
When integrating SQL Reporting Services 2005 with Sharepoint Services 3.0, and you have a SRS report that runs over a view with the UserID as a parameter (to filter the records the user has access to), will the SharePoint ReportViewer passover the UserID to RS and RS to SQL? Sharepoint security with Reporting Services stops at Item level or does it impersontate down to SQL? Should authenticating be Integrated or SQL ? Should the userid in SQL be exact match with Sharepoint? Or are they mapped somewhere? Thank You!!
View Replies !
Can I Pass SQL Userid Password As Parameter To Report
Hi, I have started using SQL Server 2005 Reporting Services. I am using SQl Server authentication where user has to supply username and password .I want to know can I Pass the SQL authentication username and password in the URL as a parameter to report. Nikhil Jahagirdar
View Replies !
CRM Reports No Longer Able To Filter On User!UserID
Hello, I have some reports running CRM data. It's basically a sales dashboard that shows each user their pipeline values. Since each user has rights to see more than just the opportunities they own, I had a filter on the report in the SQL WHERE clause. It said WHERE @UserID = systemuser.DomainName. The @UserID parameter's value was =User!UserID, which brought back the logged-in user's domain name, which matched the field in my WHERE clause. Now, in CRM 4.0, to eliminate the need for a VPN to access reports, everyone who accesses a report is logged in as NT Authority Network Service. Does anyone know if there's still a way to access the person's domain identity? Thanks, Andy
View Replies !
Help With Trying To Insert The UserName Of The Logged In User Into The DB Field UserID
How do I insert the UserName of the Logged in user into the DB field UserID. I created a web form page, and added a form view control set the page default to Insert Mode. The Page is used to insert data. I have a hidden field called UserID that I would like to capture the Logged in user. I have logged in to the default page with userID and password, added a new record, and the db table field UserID is empty. I have been trying to figure out what I am doing worng, but no luck, Please suggest the best way to do this. I have listed what I have done thus far? I have added the login Control from Login and added it to the page as a hidden field thinking that I needed to have this field on the page to get this to work where you copy the value in the Loginname field to the useridTextbox on the formview1 insert template. I read on line where the method below is better. Please tell me what I am doint wrong. System.aspx---------------------------------------------------------------------------------------------------------------1) <asp:FormView ID="FormView1" runat="server" AllowPaging="True" DataKeyNames="SystemID" DataSourceID="SystemSqlDataSource1" DefaultMode="Insert" Width="583px">2) <asp:TextBox ID="UserIDTextBox" runat="server" Text='<%# Bind("UserID") %>' Visible="False"></asp:TextBox><br />3) <asp:SqlDataSource ID="SystemSqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:RCMISConnectionString %>" DeleteCommand="DELETE FROM [tblSystem] WHERE [SystemID] = @SystemID" InsertCommand="INSERT INTO [tblSystem] ([SystemID], [SystemDesc], [Inactive], [TimeStampEntry], [TimeStampUpdate], [UserID]) VALUES (@SystemID, @SystemDesc, @Inactive, GETDATE(), @TimeStampUpdate, @UserID)"4) <InsertParameters> <asp:Parameter Name="SystemID" Type="String" /> <asp:Parameter Name="SystemDesc" Type="String" /> <asp:Parameter Name="Inactive" Type="Boolean" /> <asp:Parameter Name="TimeStampEntry" Type="DateTime" /> <asp:Parameter Name="TimeStampUpdate" Type="DateTime" /> <asp:Parameter Name="UserID" Type="String" /> </InsertParameters> </asp:SqlDataSource>System.aspx.vb---------------------------------------------------------------------------------------------------------5) Partial Class MemberPages_RCM_frmSystem Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'UserIDTextBox.Text = Membership.GetUser().ProviderUserKey.ToString() End Sub Protected Sub FormView1_ItemInserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewInsertedEventArgs) Handles FormView1.ItemInserted 'Set the UserID Value to the currently logged on user's ID e.Values("UserID") = Membership.GetUser().ProviderUserKey End SubEnd ClassThank you in advance,
View Replies !
How To Pass Profile Userid Into Stored Proc As A Parameter
Hi, I have created an insert stored procedure which inserts a userid into an sql server 2005 field of datatype uniqueidentifier. What datatype would the parameter be in my c# code? do i pass it in as an object datatype? the code is below.... 1 conn = new SqlConnection(ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString); 2 3 cmd = new SqlCommand("spInsKeyswap_history", conn); 4 5 cmd.CommandType = CommandType.StoredProcedure; 6 7 MembershipUser mu = Membership.GetUser(User.Identity.Name); 8 9 object gdUserID = mu.ProviderUserKey; 10 11 12 13 14 15 cmd.Parameters.Add("@user_title", SqlDbType.VarChar, 50); 16 17 cmd.Parameters.Add("@first_name", SqlDbType.VarChar, 20); 18 19 cmd.Parameters.Add("@last_name", SqlDbType.VarChar, 50); 20 21 cmd.Parameters.Add("@email", SqlDbType.VarChar, 50); 22 23 cmd.Parameters.Add("@birthday", SqlDbType.VarChar, 15); 24 25 cmd.Parameters.Add("@alternate_number", SqlDbType.VarChar, 50); 26 27 cmd.Parameters.Add("@msisdn", SqlDbType.VarChar, 50); 28 29 cmd.Parameters.Add("@call1", SqlDbType.VarChar, 50); 30 31 cmd.Parameters.Add("@call2", SqlDbType.VarChar, 50); 32 33 cmd.Parameters.Add("@call3", SqlDbType.VarChar, 50); 34 35 cmd.Parameters.Add("@new_sim_msidn", SqlDbType.VarChar, 50); 36 37 cmd.Parameters.Add("@dealer_id", SqlDbType.UniqueIdentifier); 38 39 cmd.Parameters.Add("@status_code", SqlDbType.Int); 40 41 cmd.Parameters.Add("@support_id", SqlDbType.Int); 42 43 cmd.Parameters.Add("@return_value", SqlDbType.Int); 44 45 cmd.Parameters["@user_title"].Value = txtTitle.Text.ToString(); 46 47 cmd.Parameters["@first_name"].Value = txtFirstName.Text.ToString(); 48 49 cmd.Parameters["@last_name"].Value = txtLastName.Text.ToString(); 50 51 cmd.Parameters["@email"].Value = txtEmailAddress.Text.ToString(); 52 53 cmd.Parameters["@birthday"].Value = txtBirthday.Text; 54 55 cmd.Parameters["@alternate_number"].Value = txtAlternate.Text.ToString(); 56 57 cmd.Parameters["@msisdn"].Value = txtNew.Text.ToString(); 58 59 cmd.Parameters["@call1"].Value = txtCall1.Text.ToString(); 60 61 cmd.Parameters["@call2"].Value = txtCall2.Text.ToString(); 62 63 cmd.Parameters["@call3"].Value = txtCall3.Text.ToString(); 64 65 cmd.Parameters["@new_sim_msidn"].Value = txtOld.Text.ToString(); 66 67 //get logged in users user_id from membership 68 69 cmd.Parameters["@dealer_id"].Value = gdUserID; 70 71 cmd.Parameters["@status_code"].Value = 1; 72 73 cmd.Parameters["@support_id"].Value = 0; 74 75 76 77 cmd.Parameters["@return_value"].Direction = ParameterDirection.ReturnValue; 78 79 cmd.ExecuteNonQuery(); 80 81 int returnValue = (int)cmd.Parameters["@return_value"].Value; 82 83 conn.Open(); 84 85 86
View Replies !
Error Inserting UserId In Codebehind Using SqlDataSource.insert()
I have a database with columnsuserOwnListsuserID uniqueidentifieruserName nvarchar100userList nvrachar100createdDateI have created successfully a gridview controller to edit these values in database. The Gridview data is populated by SqlDataSource.I have also created a EmptyDataTemplate and created a form into it. There is only one textBox and submit button to create the First entry to userOwnLists -table.Now I collect the value from EmptyDataTemplate textbox with id userList1 and create a codebehind logic for the submitbutton.protected void Button2_Click(object sender, EventArgs e) { TextBox listName = (TextBox)this.FindControl("listName1", GridView1.Controls);SqlDataSource1.InsertParameters["userId"].DefaultValue = Membership.GetUser().ProviderUserKey; SqlDataSource1.InsertParameters["userName"].DefaultValue = Membership.GetUser().UserName.ToString(); SqlDataSource1.InsertParameters["listName"].DefaultValue = listName.Text; SqlDataSource1.InsertParameters["createdDate"].DefaultValue = DateTime.Now.ToString(); SqlDataSource1.Insert(); }The problem is now that I get error: Exception Details: System.Data.SqlClient.SqlException: Implicit conversion from data type sql_variant to uniqueidentifier is not allowed. Use the CONVERT function to run this query.OK. So I Googled a bit and found this:http://scottonwriting.net/sowblog/posts/4690.aspxMy Question is: How do I convert userId so I can insert it to database successfully?This does not work:String userId = Membership.GetUser().ProviderUserKey.ToString(); SqlDataSource1.InsertParameters["userId"].DefaultValue = Convert.ToString(userId);
View Replies !
How To Deal With User!UserID In Data-Driven Subscriptions
First a bit of background. We use the Windows-logon to authenticate en identify the user. With this logon we check within most of our reports what a user is allowed to see. Depending his level or geographical location he is allowed to run reports on one to all sites. He can selects the sites from a Multiple Select box. This works fine. Now, we want to use data-driven subscriptions, I understand why we can't use this parameter, but how do you people deal with this kind of configurations. I would prefer not to 'double' the reports in a normal and a subsciption version .....
View Replies !
Subscription With Table Filter Using User!UserID Not Displaying All Data
Hey, Microsoft....is this a bug? We have SSRS 2005 SP1. The result set returns data for 50 employees. I use a table filter: User!UserID = Fields!NtUserName.Value. I substituted my NtUsername for Fields!NtUserName.Value. When I generate the report all is well - I can see the data on all of the employees. From prior testing, I know that when I use the table filter 'User!UserID = Fields!NtUserName.Value' each employee will see only their data. I want to send a link to all of the employees that will open the last history record. In Report Manager... report Properties tab....History Window..I have checked 'Allow report history to be created manually' and 'Store all report execution snapshots to report history.' In the Execution window I selected 'Render this report form a report execution snapshot" and am using a Shared schedule. I created a Subscription to email me the link. When I select 'Create a report snapshot when you click the Apply button on this page' in the Execution tab, all is well - an email is sent and when I click the link I can see the data for all 50 of the employees (I use a page-break by Employee group so there are 50 pages). However, when the report is generated using the shared schedule, only the first record in the report is displayed and it shows there is only 1 page in the report; and the size of the report is slightly smaller (292 KB vs. 536 KB). If I create a 'New Snapshot' from the History tab, I can see the data on all of the employees, however, using the link that was emailed when I executed the schedule, I again only see the first employee in the report (perhaps the email does not link back to the history record created in this manner?). Additionally, when I create a linked report and manually generate it, again only the 1st employee in the result set is in the report. I've tried many things, including using the NtUsername of 'dbo' and the NtUsername of the account the DataSource is using, but no luck. Any suggestions??? I am tired of manually executing this report twice a week, but thankful I don't have to do this every hour of the business week!!!
View Replies !
Can't View A Linked Report Snapshot Using User!UserID In The Table Filter
In Report Manaager I cannot generate a useable snapshot for a linked report that uses User!UserID in a table filter. The original report works fine, I can create a History record for the linked report, but when I try to view the snapshot an error is thrown: e ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException: An error has occurred during report processing., ; Info: Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException: An error has occurred during report processing. ---> Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. I deployed a copy of this report without using User!UserID in the table filter - and I successfully created a linked report where the snapshot was viewable. Appears to me that I can't use the User!UserID in the Table filter for a linked report snapshot. Can anyone shed some light on this?
View Replies !
Connect To .DataSource=&&"....&&" Using Authetication (userid && Passphrase)!
Hi, My school is runnnig SQL Server 2005 and i want to connect to it using authetication (userid & passphrase). As i coded the windows application i used localhost as my own computer and IntegratedSecurity shown below. I'm new in C# and SQL. I would appriciate if someone could help me out. using System; using System.Data; using System.Data.SqlClient; using System.Text; namespace Personregister { class DBManager { SqlConnection conn; SqlConnectionStringBuilder builder; public DBManager() { builder = new SqlConnectionStringBuilder(); builder.DataSource="localhost"; builder.InitialCatalog = "Personregister"; builder.IntegratedSecurity = true; conn = new SqlConnection(builder.ToString()); } // more code fallows ...... } } Best Regards,
View Replies !
Stored Procedure With User!UserID As Parameter, As Report Parameter?
I had thought that this was possible but I can't seem to figure out the syntax. Essentially I have a report where one of the parameters is populated by a stored procedure. Right now this is easily accomplished by using "exec <storedprocname>" as the query string for the report parameter. However I am not clear if it is possible to now incorporate User!UserID as parameter to the stored procedure. Is it? Thanks
View Replies !
How To Set A Relationship Here?
How to create a relation between gf_game and gf_gamegenre here? gf_gamegenre is responsible for the relation between a game and it's genre(s). The relationship between gf_genre and gf_gamegenre worked. (http://img361.imageshack.us/my.php?image=relationzl9.jpg) When I try to set a relationshop between gamegenre and game I'm getting this error: 'gf_game' table saved successfully'gf_gamegenre' table- Unable to create relationship 'FK_gf_gamegenre_gf_game'. The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_gf_gamegenre_gf_game". The conflict occurred in database "gamefactor", table "dbo.gf_game", column 'gameID'. Thanks for any help!
View Replies !
Need Help With Relationship
I have this situation in my DB: tblClients, ClientID(pk) 1---M tblDocuments, DocumentID(pk), ClientID(fk), DocumentTypeID M---1 tblDocumentTypes, DocumentTypeID(pk)(this is a lookup table) If a client is deleted I want to cascade and delete that clients documents from tblDocuments. When I set the relationships delete and update to cascade on tblDocuments it is also set to cascade on the lookup table (tblDocumnetTypes). Why is this and how do I make it stay the way I want it?
View Replies !
|