Problem With Aspnet_users

Oct 5, 2006

Hello,
 I hope this is the right place to ask my question. I'm making an website as project for school it is ment to help students learn and practice physics. i wanted some additional info stored with the user data like in witch year the student is and wether or not he ad practiced a specified toppic. when u want to edit the gridview (in internet explorer) it gives the following error:

Server Error in '/pws_web' Application. Implicit conversion from data type sql_variant to uniqueidentifier is not allowed. Use the CONVERT function to run this query.
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: Implicit conversion from data type sql_variant to uniqueidentifier is not allowed. Use the CONVERT function to run this query.

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): Implicit conversion from data type sql_variant to uniqueidentifier is not allowed. Use the CONVERT function to run this query.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +177
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +68
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +199
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2305
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +147
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1021
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +314
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +413
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +115
System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation) +392
System.Web.UI.WebControls.SqlDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +643
System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +78
System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32 rowIndex, Boolean causesValidation) +1218
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +853
System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e) +87
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e) +117
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +86
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +153
System.Web.UI.WebControls.LinkButton.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) +172
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4921


Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
 
I'm glad with every sugestion

View 1 Replies


ADVERTISEMENT

Aspnet_users And Custom Tables

Jan 8, 2008

Hey all,
I am pretty new to the aspnet default database but I have a question about it.  This may be a stupid question.  I configured my website to use the aspnet user database however I also have tables I built whic use a UserID.  Now the UserID in the aspnet_users table is a uniqueidentifier so I set the UserID in all my tables to a unique identifier and attached them as foreign keys to the aspnet_users UserID.  Now where I am confused is how do I insert that key into the tables I built when a user for instance places a "new order" or anything really.  Any information would help I am still pretty knew to this. Just for the sake of simplicity I provided a basic table that lets say for instance I am trying to get the UserID for.  How would I get that UserID from the aspnet_users table into the Orders table when a person places a new order. 
Orders
OrderID - uniqueidentifier
UserID - uniqueidentifier
ProductID - uniqueidentifier 
OrderDate - datetime
 
Thanks,
Chris

View 4 Replies View Related

Joining Tables On Aspnet_Users.UserId

Nov 8, 2006

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 5 Replies View Related

Aspnet_Users' LastActivityDate VS. Aspnet_Membership's LastLoginDate

Jul 17, 2007

In my web application, each person's page is to display when their last logged on date and time was.  Which is the proper value to access - LastActivityDate or LastLoginDate?
Also, if I wanted to obtain the amount of time that has elapsed since the person last logged in until now, would I do something like .....
DateTime.Now.Subtract(Membership.GetUser("username").LastLoginDate()).TotalHours()
if I wanted to represent the time elapsed in hours?  Just wanted to make sure this is the correct method.
Thanks. :)

View 3 Replies View Related

Why Could Not Databind The Gridview To The Aspnet_Users That Table.

Aug 11, 2007

I want to databind  the gridview to the  "aspnet_Users" that table  to view and edit the data, but when I configure the Datasource in the gridview, I could not find that table, the gridview only show the vw_aspnet_Users that view. I don't know what the problem is?
 
thanks
 

View 2 Replies View Related

Stored Procedure To Retrieve UserId From Aspnet_Users

Jan 17, 2008

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 4 Replies View Related







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