Getting a value from a SQL table displaying a specific page based on that value

May seem to newbie but here goes:

I have a login page.  For the login I run a stored procedure with 4 return values,
0 - being valid,
1 - username exists already,
2 - username is incorrect
3 - password is incorrect

This all works fine.  But from that I have the default page when the login credentials are correct.  The issue is I need to display a specific default page based on their location id from the member table which I already run a sp against for the login.  I have set up an .ascx page with a datagrid to display the results which works when I run the query for a hard coded locationid.  My problem is getting the locationid based on the username and displaying correctly their login page.

Should I run check in the already existing stored proc and return the location id and if so how do I do that?
Or should I run a query on the page load of the default page to display the datagrid results based on the locationid that exists for the userid?

I am sure this is simple but I have spent all day trying to get it to work without success.  Any help is appreciated
0
ksurb
7/25/2005 8:23:50 PM
asp.net.getting-started 91979 articles. 4 followers. Follow

2 Replies
876 Views

Similar Articles

[PageSpeed] 21

If you have all of the data you need in the database, you should try to get it all in one procedure call if possible (and if it makes sense logically). This likely means changing the way your procedure works though. Can you post your existing procedure code?


||| Kristopher Cargile
||| http://www.kriscargile.com/blog/
0
kcargile
7/25/2005 10:51:41 PM

Here it is:


PROCEDURE [dbo].[spAuthenticate]

(
 @username Varchar( 50 ),
 @password Varchar( 50 )
)
As

DECLARE @foundUser Varchar( 50 )

SELECT @foundUser = Email1
 FROM Members
 WHERE Email1 = @username
 AND PWD = @password
 AND STATUS <> '0'
 AND EXPIRE >= GetDate()

IF @foundUser IS NOT NULL
 RETURN 0
ELSE
 IF Exists ( select Email1
  FROM members WHERE Email1 = @username
  AND EXPIRE < GetDate() )
  RETURN 4
 IF Exists ( select Email1
  FROM members WHERE Email1 = @username
  AND STATUS = '0' )
  RETURN 3
 IF Exists ( select Email1
  FROM members WHERE Email1 = @username )
  RETURN 2
 ELSE
  
  RETURN 1
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO


So this works fine but I have 8 or so chapters that display different data.  So based on the locationid of the users validated against this stred proc I want to display the correct page.  If you can provide some help putting it in this that would be great, thanks.

0
ksurb
7/26/2005 12:29:38 AM
Reply:

Similar Artilces:

problem with get value from textbox after get it value in load page
hi every one  i have problem with my web site when i get textbox value in load page   and Changed textbox the page do not take last value .   it take value in load page   this is code:Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)   TextBox1.Text = "aa" End SubProtected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) MsgBox(TextBox1.Text) End Sub   when i press button message write "aa" while i changed the textbox   please if enyone knowen help me &nbs...

Query for substring to get some particular value in a string (Get querystring value by sql )
I have a column name URL in Table1 with data like  <a href="/Folder1/view_media_news.cfm?news_media_i=1">August 2002 Factsheet</a>            <a href="/Folder1/view_media_news.cfm?news_media_i=149">March 2002 Newsletter </a>  i need to grab the news_media_i value by sql query  Please any one can help me to get that particular value from string using substring or any other suggestion Thank you in advance SurendraIf this helps mark it as answer surendra_kla:i nee...

get value from <select> value & display value
hi all, i want these two bold values which are below,  underline value i can get but second bold value i m not avail to get please help.... <select><option value="ma">manoj</option> </select> regard khushak  P.S. if possible then Please with  java script other wise code behind New In .NET World See my post in this thread.  That should take care of you. Peter BrunoneMS MVP, ASP.NETFounder, EasyListBox.comDo the impossible, and go home early....

Get The Value Of DropdownList Box Display Value
I've a DW with a dropdown listbox. For some reason I would like to get the value of my Dropdown Listbox "display value". So can you tell me how...? Thanks Hi, What we do is creating a computed field containing a 'lookupdisplay()' call for that column. You can then access this computed field for getting the display value. HTH -- Met vriendelijke groet, - Eric Aling [TeamSybase], Cypres Informatisering bv, The Netherlands Eric's Home & PB Site @ http://utopia.knoware.nl/users/cypr115 sofian <sofianlutfi@hotmailcom> wrote in message...

DropDownList
<%@ Page Explicit="True" Language="VB" Debug="True" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.OleDb" %> <HTML> <Script Runat="Server"> Dim aConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" _ & server.mappath("Group17.mdb") Sub Page_Load(Sender As Object, E As EventArgs) Dim aConnection As OleDbConnection Dim aQuery, bQuery As String Dim aDataReader, bDataReader As O...

Setting the value of a RadioButtonList based on a value in my sql table.
Hi folks, From a Sql database table I'm trying to display a RadioButtonList with two text values, "Buy" and "Sell". The actual numeric values in my table are 1 (Buy) or 2 (Sell). The name of the column in the table is "buy_sell". So how do I set the SELECTED="TRUE" property in the ListItem based on the value of my buy_sell column ? <asp:FormView ID="FormView1" runat="server" DataSourceID="ObjectDataSource1" OnInit="FormView1_Init"> .. .. <EditItemTemplate> <td><asp:RadioButtonList  DataSourceID="ObjectDataSource1" DataValueField="buy_sell" DataTextField...

How to get element value based on conditional sibling value?
Hello,  I have an XML document that looks like this:1 <?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?> 2 <temperatures> 3 <station> 4 <stationid>1234</stationid> 5 <temperature> 6 <temperaturedate>2008-10-01 00:00:00</temperaturedate> 7 <temperaturevalue>20.2</temperaturevalue> 8 </temperature> 9 <temperature> 10 <temperaturedate>2008-10-02 00:00:00</temperaturedate> 11 <temperaturevalue>24.2<...

Get all values from Mapping Table including duplicate value
Hi all, I define a local variable as a node set that gets value from Mapping Table. It always returns unique value. For example, local variable is supposed to return {"","","1","3","2","3"} when the destination equals "100". But it returns {"","1","3","2"} every time. How can I get all value from mapping including the duplicate value? Here is my rule: > <do-set-local-variable name="lvPosition" scope="policy"> > <arg-node-set&g...

Getting the display value from a code table
Is there a way in PowerScript to get the display value from a code table within a column object that is set up as a dropdownlistbox? I am currently using GetItemString but that returns the Data value. Look up LookupDisplay in help -- This is a FAQ, read Help, then search www.groups.google.com/advanced_group_search pbm_thisusuallydoesnothelp:-)) Philip Salgannik <Chris Schroll> wrote in message news:42f3dd4d.6c2e.1681692777@sybase.com... > Is there a way in PowerScript to get the display value from > a code table within a column object that is set up as a >...

get the values reflected from database table as soon as the value changed!
hai, if the admin changes the value at the database table then it should be reflected to all the pages which is viewing that particular record. We should not use any frequent refresh from the browser. The pages get refreshed as soon as the values changed at database. Thanks in advance Bye   I don't think it can be done. web application is stateless, web client (browser) and web server lost connection once content downloaded, the web server can not "Push" content to client, it must be "Pulled" by web client (browser).Richard XinMCAD(charter member),MCDBA,MCSDWeb Site: www.richar...

How can I get a value from a table, then store a related value in another
I hope I can explain this with some degree of sensibility. First, this is a fairly simple Master/Detail page with GridView and  DetailsView controls.  GridView1's SqlDataSource1 uses a sql view that joins two tables (tblMain and tblEmployees) on UserId and adds a UserName column to the grid.  GridView1 filters on invisible Textbox1 which has been populated with the currently logged in user's name via Textbox1.Text = User.Identity.Name DetailsView1 filters on the current SelectedIndex of GridView1, and provides New, Edit, and Delete functionality on tblMain data from SqlDat...

Getting value of a detailsview field before displaying the page
I have a Gridview master and a detailsview control that displays when a record in gridview is displayed.  How the detailsview is displayed depends on the value of one of the fields.  How can I read that value before displayig the detailsview control?  Theis field is also displayed in the Gridview, maybe it would be easier to get it from there?  If the row in your GridView is actually selected, then you can retrieve any data from the row using the GridView.SelectedRow property and extracting the info from there.Thanks, EdMicrosoft MVP - ASP/ASP.NET  I thought I co...

How to get a value from SortedList value
 Hi, the problem is as topic. I saved a sortedList with the value in which it contains multi-value. In my SoeredList "cart", the values are Quantity, UnitPrice, ProductName.Can anyone teach how I can get the values from the cart? Hi photossed, I notice that the status of the post is “Resolved”, is it marked yourself? If so, please post your answer in order that more others member learn from it.  Hong-Gang ChenMicrosoft Online Community SupportPlease remember to mark the replies as answers if they help and unmark them if they provide no help....

Get info from PropertyValueString
Hi All, I have inherited a project written by someone who was a much better programmer than myself and would appreciate some help in the right direction as I am way out of my depth. The problem is I need info about the logged in users profile in the asp_netProfile table which contains a field "PropertyValueString" with xml (nText field) in that looks like this:  <?xml version="1.0" encoding="utf-16"?><ProfileObject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"...

Web resources about - Getting a value from a SQL table displaying a specific page based on that value - asp.net.getting-started

List of birds displaying homosexual behavior - Wikipedia, the free encyclopedia
This list includes birds for which there is documented evidence of homosexual or transgender behavior of one or more of the following kinds: ...

Facebook Displaying Page Insights On Page Admins’ Personal Pages?
Some Facebook page administrators are seeing modules on their personal pages displaying page insights ad, campaign , and like totals for pages ...

Facebook Displaying Unread Messages from Pages in a New Updates Module
Facebook is displaying a new “Updates” sidebar module which shows some users unread messages sent to them by Pages. Users will see the Updates ...

Don Lemon Holds Up Sign Displaying the N-Word, Uncensored, on Air CNN Live - YouTube
Don Lemon Holds Up Sign Displaying the N-Word, Uncensored, on Air Lemon held up a Confederate flag first before holding up the sign. He asked, ...

Hazelwood coal mine fire: Morwell residents displaying symptoms similar to cigarette smokers, expert ...
An expert says some locals near Victoria's Hazelwood mine fire have symptoms similar to cigarette smokers.

Police accused of displaying fake G20 weapons
Toronto's top police officer misled the public by displaying fake weapons used in a medieval-themed role-playing game to help justify their actions ...

Displaying calorie labels at fast-food restaurants doesn't appear to work: study
While the high calorie counts of artery-clogging fast foods are often printed right in front of our eyes, most people ignore them and go ahead ...

Jays' Escobar suspended three games for displaying slur
Toronto Blue Jays shortstop Yunel Escobar has been suspended three games for displaying a homophobic slur on his eye-black during a game on Saturday. ...

Google Play Store now displaying age-based ratings
We reported back in May that Google was adding age-based ratings to all apps in the Play Store as determined by the International Age Rating ...

Google begins displaying “Listen Now” ads for streaming music services (including Beats) in search results ...
... , Streaming Music Continue reading more about Apps , Google , and Spotify at 9to5Mac . What do you think? Discuss "Google begins displaying ...

Resources last updated: 1/22/2016 1:30:26 AM