Jump to content

kevin.upshaw

Members
  • Content Count

    17
  • Joined

  • Last visited

Everything posted by kevin.upshaw

  1. Hi, I wonder if someone can help. I am trying within a WebGrid to create a link on the (using the HTML anchor tag) Asset Tag column - so then when the user clicks on an asset tag it directs them to a Display Report page - where it displays a transaction report on that particular asset. I have searched and searched the internet, and found the solution below. However it displays the following error message: Server Error in '/' Application. Object reference not set to an instance of an object.Description: An unhandled exception occurred during the execution of the current web request. Please r
  2. Cracked it!It took someone else to go through it with me to realise what it is. I thought "transaction" and "user" were displayed in a colour they shouldn't be in on the WebMatrix software. So I created a bogus "transaction1" and "user1" table and put some fake data in them - then created the relationship between them. The query works absolutely fine now - so I'm guessing it was because I was using reserved words as my table names - will make sure I use proper names next time, would have saved so much time! Thank's very much for your help. Much appreciated. Kevin
  3. I receive the error: "Incorrect syntax near the keyword 'transaction'". I am using WebMatrix - Using ASP.NET Web Pages - Razor Syntax (C#). However I am trying to do the query ion the WebMatrix environment before trying to code it into a web page/ Am running SQL Express on my laptop. Could perhaps try installing Visual Studio 2010 and running the query from there?
  4. Hi, I tried the following: SELECT transaction.transactionId, user.firstName, user.lastNameFROM transactionINNER JOIN userON transaction.userId=user.userIdORDER BY user.userId No joy. It wouldn't perhaps be because my table names are reserved names? I know "user" is. Thanks. Kevin
  5. Hi.Wonder if you can help, am quite new to SQL. In simple terms, I have a transaction table - and in that table are references to other related tables. In this simple query I am trying to obtain the first name and last name from the user ID for a transaction. SELECT transaction.transactionId, user.firstName, user.lastNameFROM [transaction]INNER JOIN [user]ON transaction.userId = user.userIdORDER BY user.userId However I get the response "incorrect syntax near the keyword transaction". I then try: SELECT 'transaction'.transactionId, user.firstName, user.lastNameFROM [transaction]INNER JOIN [us
  6. Hi. Not quite sure where to start with this one. Am creating a website at the moment, and within that site - in my SQL Compact database I have a "transaction" table. There will be thousands of records in that table - what I want the user to be able to do is search based on a particular parameter - which is fine as I can just use SQL to obtain that information. However, say for instance it returns 100 records - I don't want to display all that data to a user all at once. How would I go about creating a facility to navigate on a table? For instance so it displays ten records at a time? I am usin
  7. Hi. Thanks for your help. I managed to get around it using this code: var extractOrderInformation = "SELECT * FROM [order] WHERE CONVERT(NVARCHAR, orderdatetime, 103) BETWEEN CONVERT(NVARCHAR, @0, 103) AND CONVERT(NVARCHAR, @1, 103)"; Thanks again. Kev
  8. I have also tried using the convert function to no joy (to return the date value): SELECT * FROM [order] WHERE CONVERT(NVARCHAR, [orderdatetime], 101) = CONVERT(NVARCHAR, '2012-05-05', 101)
  9. Hi. I have tried the following query: SELECT * FROM [order] WHERE orderDateTime LIKE '%2012-05-04%' Unfortunately that doesn't return anything. However if I run this query: SELECT * FROM [order] WHERE orderDateTime LIKE '%2012%' It pulls back all my orders. Its as soon as I put a "-" or a "/" it just doesn't return any values. Kev
  10. Hi. Wonder if anyone can help. Am trying to retrieve records from my order table from a date inputted by the user. I've done all the SQL on my site up to here - this one is really baffling me through. Query: SELECT * FROM [order] WHERE orderDateTime LIKE '04/05/2012%'; However, it doesn't return any values - see my data types in my table below: As you can see from the data view there is data applicable in there to my query: Am at a loss. Can anyone help? Thanks. Kevin
  11. Hi. Wonder if anyone can help. I have a page (which hopefully when finished) will allow a administration user to go in and update the availability of products. I have done a query first to pull the records from the SQL database, and have then used a loop to display the records in a table: @{ Layout="~/Shared/accountArea.cshtml"; Page.Title="Update Product Availability | Sarnies For All"; if (WebSecurity.IsAuthenticated == false) { Response.Redirect("~/"); } var db = Database.Open("sarniesForAllCurrent"); var extractBread = "SELECT * FROM bread ORDER BY breadId
  12. Again, that worked a treat, thanks for your help.
  13. I'm not really sure where to start. On my "New Order" page I have the following code: <form id="newOrder" method="post" action="processOrder.cshtml"> Then on the "processOrder.cshtml" page I tried the following: @{ Layout="~/Shared/accountArea.cshtml"; Page.Title="Process Order | Sarnies For All"; if (WebSecurity.IsAuthenticated == false) { Response.Redirect("~/"); } if (IsPost) { var breadSelection = breadSelection.Value; } } <h1>Order Status</h1><p>@breadSelection</p> I tried the above just to see if it would pull the
  14. Hi. Quite new to ASP.NET, doing a web design course. I have built a website, and am just building the order part - this is for an assignment. This is the code I have so far: @{ Layout="~/Shared/accountArea.cshtml"; Page.Title="New Order | Sarnies For All"; if (!WebSecurity.IsAuthenticated) { Response.Redirect("~/"); } var db = Database.Open("sarniesForAllCurrent");} <h1>New Order</h1> <p>Here you can create your own sandwich. First of all select your desired bread type from the drop down box below. Then move on to select the filling which
  15. That's brilliant, worked a treat. Cheers.
  16. Forgive me, am new to ASP.NET, am doing a web design module in my degree and am trying to build a website from scratch for my assignment. I had (perhaps foolishly) included the code: <a href="@{WebSecurity.Logout();}"> In a breadcrumb style bar to which (in my thinking) the user could then click the link which would log them out, however - from what you just said I have realised that every time the page is rendered the user will then be logged out - I was staring at the screen far to long yesterday. What would you suggest the best way to allow someone to logout? Thanks. Kevin
  17. Hi. Wonder if anyone can help. I am trying to build a website where users can log in to their account, and then place an order for an item, edit their details etc. However, am using the following code upon loading the myAccount.cshtml page: if (WebSecurity.IsAuthenticated == false) { Response.Redirect("~/"); } So that if the user is not logged in it directs them to the home page to then login. However I am finding that even when the user has logged in, as soon as they come away from the My Account area - it logs them out and they then have to log back in. How could I make this so
×
×
  • Create New...