943,879 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 418
  • ASP.NET RSS
Jan 6th, 2009
0

How Can I Use View Here

Expand Post »
Hi Frends,
Can I use View Insted of query in my code.
If yes Then plz tell me how can.


asp.net Syntax (Toggle Plain Text)
  1. Protected Sub checkavailabilityusername(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewInsertEventArgs) Handles usersformview.ItemInserting
  2. Dim name As TextBox
  3. Dim username As String
  4. Dim Query As String
  5. Dim dr As SqlDataReader
  6. Dim db As DBConnection
  7. db = DBConnection.getConnection()
  8. name = usersformview.FindControl("username")
  9. username = name.Text
  10.  
  11. Query = "SELECT [username] FROM [customer] where [username] = '" & username & "' "
  12. dr = db.executeQuery(Query)
  13. If dr.Read = True Then
  14. e.Cancel = True
  15.  
  16. errmsg.Text = "<h5 style='color:#270000;'> The User Name you have entered is already exists.Please enter another User Name.</h5>"
  17. 'Response.Write("<h4 color=red> The Country name you have entered is already exists.Please enter another the country name.</h4>")
  18.  
  19. End If
  20. dr.Close()
  21.  
  22. End Sub
  23.  



Thanks
Last edited by peter_budo; Jan 11th, 2009 at 2:41 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
chinni1 is offline Offline
11 posts
since Dec 2008
Jan 6th, 2009
0

Re: How Can I Use View Here

A view is, in essence, a virtual table which is based on SQL SELECT query. It does not physically exist. A view is an object that can derive data from one or more tables. For Eg Suppose there is a Users Table named customer which has some 100 columns and your wish to create a view with just the userName column

sql Syntax (Toggle Plain Text)
  1. CREATE VIEW view_UserNames AS
  2. SELECT UserName
  3. FROM customer

Now rather than using the customer table you can use the view 'view_UserNames' in you code.
Last edited by peter_budo; Jan 11th, 2009 at 2:42 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reputation Points: 16
Solved Threads: 18
Junior Poster
Aneesh_Argent is offline Offline
104 posts
since Dec 2008
Jan 6th, 2009
0

Re: How Can I Use View Here

A view is, in essence, a virtual table which is based on SQL SELECT query. It does not physically exist. A view is an object that can derive data from one or more tables. For Eg Suppose there is a Users Table named customer which has some 100 columns and your wish to create a view with just the userName column

CREATE VIEW view_UserNames AS
SELECT UserName
FROM customer

Now rather than using the customer table you can use the view 'view_UserNames' in you code.











Ok Thanq
Reputation Points: 10
Solved Threads: 0
Newbie Poster
chinni1 is offline Offline
11 posts
since Dec 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Screen Capturing in a Web Application
Next Thread in ASP.NET Forum Timeline: Using login form control, how to redirect users to different pages?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC