How Can I Use View Here

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2008
Posts: 11
Reputation: chinni1 is an unknown quantity at this point 
Solved Threads: 0
chinni1 chinni1 is offline Offline
Newbie Poster

How Can I Use View Here

 
0
  #1
Jan 6th, 2009
Hi Frends,
Can I use View Insted of query in my code.
If yes Then plz tell me how can.


  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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 104
Reputation: Aneesh_Argent is an unknown quantity at this point 
Solved Threads: 18
Aneesh_Argent Aneesh_Argent is offline Offline
Junior Poster

Re: How Can I Use View Here

 
0
  #2
Jan 6th, 2009
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

  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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 11
Reputation: chinni1 is an unknown quantity at this point 
Solved Threads: 0
chinni1 chinni1 is offline Offline
Newbie Poster

Re: How Can I Use View Here

 
0
  #3
Jan 6th, 2009
Originally Posted by Aneesh_Argent View Post
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ASP.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC