School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,419 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,506 people online right now. Registration is fast and FREE... Join Now!




sql help

 

sql help

Fusion.01

22 Jun, 2009 - 05:10 PM
Post #1

New D.I.C Head
*

Joined: 17 Jan, 2009
Posts: 37

hi guys i'm doing a view feedback function,whereby users will enter their email and name to view their feedback replied.i'm not sure of the sql to do retrieve the feedback via name and email.this is the current code that i'm working on.there's a error tho.
CODE
Dim sql As String = "SELECT FeedbackDesc FROM FeedbackReply WHERE(Name = '" & txtName.Text.Trim & "',Email = '" & txtEmail.Text.Trim & "');"
      


User is offlineProfile CardPM
+Quote Post


CamoDeveloper

RE: Sql Help

22 Jun, 2009 - 05:23 PM
Post #2

D.I.C Head
Group Icon

Joined: 12 Jun, 2009
Posts: 204



Thanked: 12 times
Dream Kudos: 200
My Contributions
Well what's the error? And, you need to retrieve the data from the database by the column name, not what the user inputs. Something like this :
CODE

SELECT
  Name
  , Email
FROM
  FeedbackReply
WHERE
  Name = Me.txtName.Text.Trim
  , Email = Me.txtEmail.Text.Trim
ORDER BY
  Name DESC


This should help get you started.

~Camo
User is offlineProfile CardPM
+Quote Post

Fusion.01

RE: Sql Help

22 Jun, 2009 - 06:14 PM
Post #3

New D.I.C Head
*

Joined: 17 Jan, 2009
Posts: 37

i wanna retreive my feedbackdesc from feedbackReply by the 2 user inputs.so should it be something like
[code]SELECT feedbackDesc
FROM
FeedbackReply
WHERE
Name = '" & txtName.Text.Trim & "', Email = '" & txtEmail.Text.Trim & "'

User is offlineProfile CardPM
+Quote Post

CamoDeveloper

RE: Sql Help

22 Jun, 2009 - 10:07 PM
Post #4

D.I.C Head
Group Icon

Joined: 12 Jun, 2009
Posts: 204



Thanked: 12 times
Dream Kudos: 200
My Contributions
Is "feedbackDesc" a table or a column? In a select statement, the first thing behind the SELECT is the column name you want to choose. You will need to provide a sample of your database so I can fully understand what you're trying to do.

~Camo
User is offlineProfile CardPM
+Quote Post

Fusion.01

RE: Sql Help

23 Jun, 2009 - 06:42 AM
Post #5

New D.I.C Head
*

Joined: 17 Jan, 2009
Posts: 37

feedbackdesc is a column is feedbackReply(table).
inside feedbackReply there's 3 column.
Name
Email
feedbackDesc.
i'm trying to retreive feedbackDesc by using name and email to choose a column
User is offlineProfile CardPM
+Quote Post

PsychoCoder

RE: Sql Help

23 Jun, 2009 - 06:43 AM
Post #6

Dyslexics Untie!
Group Icon

Joined: 26 Jul, 2007
Posts: 14,714



Thanked: 501 times
Dream Kudos: 11450
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net, jQuery

My Contributions
You're missing an AND between the 2. Try this

CODE

SELECT
  Name,
  Email,
  feedbackDesc
FROM
  FeedbackReply
WHERE
  Name = Me.txtName.Text.Trim
  AND Email = Me.txtEmail.Text.Trim
ORDER BY
  Name DESC

User is offlineProfile CardPM
+Quote Post

CamoDeveloper

RE: Sql Help

23 Jun, 2009 - 07:42 AM
Post #7

D.I.C Head
Group Icon

Joined: 12 Jun, 2009
Posts: 204



Thanked: 12 times
Dream Kudos: 200
My Contributions
QUOTE(PsychoCoder @ 23 Jun, 2009 - 06:43 AM) *

You're missing an AND between the 2. Try this

CODE

SELECT
  Name,
  Email,
  feedbackDesc
FROM
  FeedbackReply
WHERE
  Name = Me.txtName.Text.Trim
  AND Email = Me.txtEmail.Text.Trim
ORDER BY
  Name DESC



Doh! crazy.gif

Can't believe I did that...grr

~Camo
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/7/09 11:50PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month