-
December 8th, 2009, 09:25 AM
#1
Using ASPNetDB.mdb
Hi all,
I work in Visual Studio 2005 with Access as my database. Am using the in-built membership management (ASPNetDB.mdb). I need to display the complete data from the table 'aspnet_Users' based on the login, Hope am clear... Please check the below select statement... I know am wrong... so please correct me...!
"SELECT ApplicationId, UserId, UserName, MobileNumber, MobileAlias, IsAnonymous, LastActivityDate FROM aspnet_Users WHERE (UserName = Login1.LayoutTemplate.UserName.ID)"
I think am not clear... see if this helps you...
I am trying to retrieve the username. After a user logs in, on the next page i have a gridview to diplay that user's info. I want to use that control in the SQL to bring back the data. Something like SELECT username, email from ASPNER_Users WHERE username = loginname.
Then I tried with this following select statement... there were no errors but it says 'There are no matching records' but the records are there for the loggedin user...!
SELECT * FROM aspnet_Users WHERE (UserName = '" + Membership.GetUser().UserName + "')
Any help would be appreciated!
Last edited by laxatcg1; December 9th, 2009 at 09:42 AM.
Reason: More information
Thank you for your support.
Best regards,
Lax
-
December 9th, 2009, 07:32 PM
#2
Re: Using ASPNetDB.mdb
Hi all,
Hope my query is clear in my earlier post... I kindly request you to guide me to proceed from there... as I got stuck... am also trying my best and I do edit my earlier post as and when I update my work.
Please help me...!
Thank you for your support.
Best regards,
Lax
-
December 9th, 2009, 08:14 PM
#3
Re: Using ASPNetDB.mdb
Take a look at this link:
-
December 9th, 2009, 11:37 PM
#4
Re: Using ASPNetDB.mdb
Thank you for your reply post. But these samples are from VS 2008 and I work in VS 2005 and I couldn;'t convert the same. Please help me out with some other alternate option. Thank you.
Thank you for your support.
Best regards,
Lax
-
December 10th, 2009, 01:29 PM
#5
Re: Using ASPNetDB.mdb
I have changed my select statement to the following:
SelectCommand="SELECT * FROM aspnet_Users WHERE (UserName = '" + Membership.GetUser(this.User.Identify.Name) + "')"
This time there's no data getting displayed and there's no error too...!
Please help me on this...!
Thank you for your support.
Best regards,
Lax
-
December 10th, 2009, 10:24 PM
#6
Re: Using ASPNetDB.mdb
That's your problem, if you have the exact thing that you posted.
'" + Membership.GetUser(this.User.Identify.Name) + "')
Here's some VB6 code. Around dates, there's #. Around strings, there's a '
Around numbers (unformatted) there is NO character. Its the same for all SQL
Code:
Private Function GetRecordset(ByVal pdteSearchDate As Date) As ADODB.Recordset
Dim strSQL As String
Dim adoRec As ADODB.Recordset
strSQL = "SELECT * "
strSQL = strSQL & "FROM AS_Createsched "
strSQL = strSQL & "WHERE AS_Createsched.CSIN_dates = #" & Format$(pdteSearchDate, "d mmm yyyy") & "# "
strSQL = strSQL & "AND HOUR(AS_Createsched.CSIN_times) = " & Format$(pdteSearchDate, "hh") & " "
strSQL = strSQL & "AND MINUTE(AS_Createsched.CSIN_times) = " & Format$(pdteSearchDate, "nn") & " "
Set adoRec = New ADODB.Recordset
adoRec.Open strSQL, GetConnString, adOpenForwardOnly, adLockReadOnly
Set GetRecordset = adoRec
Set adoRec = Nothing
End Function
-
December 11th, 2009, 09:08 AM
#7
Re: Using ASPNetDB.mdb
Thank you for your reply post....But I still couldn't get it...! I know am still wrong with my select statement.... could you please correct my Select statement ?
Thank you for your support.
Best regards,
Lax
-
December 11th, 2009, 08:57 PM
#8
Re: Using ASPNetDB.mdb
I tried using this select statement:
Select * FROM aspnet_Users WHERE (UserName = '<%=Membership.GetUser(this.User.Identify.Name).ToString;%>')"
But this doesn't return any data and it was just blank...!
Thank you for your support.
Best regards,
Lax
-
December 12th, 2009, 04:29 PM
#9
Re: Using ASPNetDB.mdb
Break it downl. Save it as a string, and then use that string in your SQL statement.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|