.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
SP
satyapriyanayak
Subhransu Sekhar Jena
abhays
DotnetUser
Post New Web Links

Using asp.net login control USERID to retrieve data from table using a where clause.

Posted By:      Posted Date: September 22, 2010    Points: 0   Category :ASP.Net
 

Protected Sub SqlDataSource1_inserting(ByVal sender As Object, ByVal e As SqlDataSourceCommandEventArgs) Handles SqlDataSource1.Inserting
    
        Dim MemUser As MembershipUser
        MemUser = Membership.GetUser()
        UserID.Text = MemUser.ProviderUserKey.ToString()
        e.Command.Parameters("@UserId").Value = MemUser.ProviderUserKey.ToString()

View Complete Post


More Related Resource Links

retrieve data from emp table????

  
Hi!   I have employee table containing salary column. I want to retrieve 3rd highest salary from the table. what would be the query for that? I can though of select top (3) salary from emp orderby desc; But I need only one result set. How can i do that?? Thanks,  

getting more data for a username from the login control

  
i have went with the standard membership method for validating and logging users into the application.  i have added a column to the adpnet_Users table called customer_number.once the user is logged in, i want to get the customer number for that user.  what is the best / easiest / industry standard method of accomplishing this?

Data retrieve (SQL table)

  

Yes I'm a newbie learning but I' developing a web app using Visual Studio 2010 where it gives the user three items to pick from and base on what they pick it returns the sub-category information which is in a SQL table.  The three name below are ListItems 

O  Author-1

O  Author-2

O Author-3

 [SubmitButton]

  (below is the return information, the liskt of books that author wrote)

 Book1

 Book2

 Book3

Book4

Would the code behind my Submitbutton(Default.aspx) be as follow:

Protect sub button1_click () handles button1_click

  Dim connectionString as String = "server='localhost'; user id = ''; password = ''; database = ''"

 Dim sqlConnection As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(connectionString)

Dim queryString As String = "Select  titlebooks * from bookTBL"

Dim sqlCommand As system.data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand(queryString, sqlConnection)

sqlConnection.Open

Dim dataReader As System.Data.SqlClient.SqlDataReader = sqlCommand.executeReader(System.data.CommandBehavior.CloseConnection)

REturn dataReader

End Function


retrieve username from login control to pass it on as a parameter for poplulation of dropdown box.

  

Hi guys,

Would appreciate some help with this.

after a successful login I'd like to retrieve the users' name via C# and pass the name on as a parameter to populate a dropdown box or a grid view on the redirected page.

To authenticate a user I use the asp.net login control and I saw that I have access to several properties and methods but can't see text or value to just get the name back and pass it on for further processing.

Am I thinking wrong here?

Any hint on how to accomplish this is much appreciated.

Thx

Ludwig


Retrieve data from SQL server based on login username (session data)

  

Hi,

I'm trying to make a dropdown list with data available based on the users login name. Heres what I have as my SQL Query in the SQLDataSource:


SELECT Client_Name, Client_ID FROM Client WHERE (Client_Name LIKE '%@Client_Name%')


So say if the login username is "User1" but the database client name is "User1 Steel" I want the dropdownlist to pull "User1 Steel" as the display and Client_ID as the value from the dropdown list. 


I dont know how to use the session data!


Getting data from table. Repeater control?

  

I'm trying to trying to create a tabe which can be resized by the user by entering the number of rows and columns in textboxes. The user should also be able to change the background color of the individual cells by clicking on them. I have figured out the code for this.

I did first try to create this table dynamically, but then I couldn't persist the changes to the table between postbascks, and I couldn't get any data from the cells when I wanted to save the table. Therefore I'm thinking of creating a repeater instead. If so, how could I specify how many times the repeater should repeat?.

I don't have a complete representation of the table in any database, I just store the exceptions and the number of rows and columns.

If anyone have a better solution to have I can do this, please share. 


"The data source control failed to execute the insert command." when inserting to sql table with tri

  

Hi,

I have a data view web part that inserts a new record into a sql table. This works fine.

I have now needed to add a trigger to the sql table that sends an email when a new record is inserted (the code for which works fine) but now my insert fails with 'The data source control failed to execute the insert command.'.

If I disable the trigger the form works fine again.

Any ideas what could be causing this?

Jeni


Using Table Adapter in Visual Studio to retrieve data

  

Hi, I have a profile of member to be displayed. I am using a dataset with all the data table adapter to retrieve the information from database. 

I have a memContact method which has NRIC and Number as a composition primary key. Thus, automatically, the table adapter has created a method called FindByICNum () for me. However, when I do the search to display the contents, i will only need to search by memberic instead. 

Is there anyway to change the table adapter query? 


How To configure Asp.net Login name control with list column Data Field?

  

 Hi,

I am trying to access site username and insert that name into list

I am trying to configure asp.net login name control with list column but for that control not having any property to configure that with list column

Is there any solution to configure asp.net control with list column by using sharepoint designer 2010?

 thanks

Basweshver


GridView control to show master-child or master-slave data, written in c#, asp.net

  
I previously made a master slave datagrid using Visual Studio 2003 .Net (original article) that would allow users to show data to clients using collapse and expand features. These features however did not carry over to gridview for many users. This tutorial will explaing how to create a collapsable/expandable gridview in frameworks 2.0 and higher

Easily manipulate data with the GridView control in ASP.NET 2.0

  
Last week, I introduced ASP.NET 2.0's GridView data control and covered the basics of using it. This week, I go a step further by going into the details of working with the data contained in the control. This includes viewing, editing, and deleting data. Thankfully, the GridView control makes it easy to utilize these features. Before diving into these topics, I begin with an examination of the different field types supported by the GridView control.

Sorting Data in a GridView Web Server Control

  
The GridView control provides built-in sorting functionality without requiring any coding. You can further customize the sort functionality of the GridView control by using custom SortExpression property values for columns as well as by using the Sorting and Sorted events

Checkboxes from data table

  

I have a data table that contains some values for Certifications.  This table can be updated in a different part of my application.  On the web page I am currently working on, I would like to have check boxes appear for every value in the data table.  I have been struggling with this trying to use a For Each loop and I cannot get it to work for anything.  Any suggestions? 

I am using the following Razor syntax to obtain my data (I know this works because I can display it in a WebGrid):

@{

var db = Database.Open("MyConn");

How to modify the login control

  

Hi,

I'd like to record more information than the default control allows as well as perform actions with the input when the form is submitted but I'm having trouble figuring out how.

So firstly, if I want to record the middlename for example, how would I do that, and by default, where would it go if anywhere?
When the form is submitted, I'd like to take specific input, such as just the middlename for example, and write some linq to sql code to specify when and how it's stored.
In what event would I put this code?

Thanks 


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend